summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [OPENMP, NVPTX] Do not globalize variables with reference/pointer types.Alexey Bataev2018-05-151-20/+19
| | | | | | | | In generic data-sharing mode we do not need to globalize variables/parameters of reference/pointer types. They already are placed in the global memory. llvm-svn: 332380
* [clang] Update uses of DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-1515-88/+96
| | | | | | | | | | | | | The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM Explicitly avoided changing the strings in the clang-format tests. Differential Revision: https://reviews.llvm.org/D44975 llvm-svn: 332350
* [Solaris] Only define _REENTRANT if -pthreadRainer Orth2018-05-151-1/+2
| | | | | | | | | | | | When looking at lib/Basic/Targets/OSTargets.h, I noticed that _REENTRANT is defined unconditionally on Solaris, unlike all other targets and what either Studio cc (only define it with -mt) or gcc (only define it with -pthread) do. This patch follows that lead. Differential Revision: https://reviews.llvm.org/D41241 llvm-svn: 332343
* [ASTImporter] Extend lookup logic in class templatesAleksei Sidorin2018-05-151-2/+8
| | | | | | | | | | | | | | During import of a class template, lookup may find a forward declaration and structural match falsely reports equivalency between a forward decl and a definition. The result is that some definitions are not imported if we had imported a forward decl previously. This patch gives a fix. Patch by Gabor Marton! Differential Revision: https://reviews.llvm.org/D46353 llvm-svn: 332338
* [X86] Revert part of r332266: Use __builtin_convertvector to replace some of ↵Craig Topper2018-05-152-24/+20
| | | | | | | | the avx512 truncate builtins. The masking doesn't work right in the backend for the ones that produce byte or word elements without avx512bw. llvm-svn: 332322
* [AST] Fix printing tag decl groups in decl contextsJoel E. Denny2018-05-151-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, given: struct T1 { struct T2 *p0; }; -ast-print produced: struct T1 { struct T2; struct T2 *p0; }; Compiling that produces a warning that the first struct T2 declaration does not declare anything. Details: A tag decl group is one or more decls that share a type specifier that is a tag decl (that is, a struct/union/class/enum decl). Within functions, the parser builds such a tag decl group as part of a DeclStmt. However, in decl contexts, such as file scope or a member list, the parser does not group together the members of a tag decl group. Previously, detection of tag decl groups during printing was implemented but only if the tag decl was unnamed. Otherwise, as in the above example, the members of the group did not print together and so sometimes introduced warnings. This patch extends detection of tag decl groups in decl contexts to any tag decl that is recorded in the AST as not free-standing. Reviewed by: rsmith Differential Revision: https://reviews.llvm.org/D45465 llvm-svn: 332314
* Enable control flow pruning of float overflow warnings.Richard Trieu2018-05-141-1/+2
| | | | | | | | | Like other conversion warnings, allow float overflow warnings to be disabled in known dead paths of template instantiation. This often occurs when a template template type is a numeric type and the template will check the range of the numeric type before performing the conversion. llvm-svn: 332310
* [c++17] Fix assertion on synthesizing deduction guides after a fatal error.Volodymyr Sapsai2018-05-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | After a fatal error Sema::InstantiatingTemplate doesn't allow further instantiation and doesn't push a CodeSynthesisContext. When we tried to synthesize implicit deduction guides from constructors we hit the assertion > Assertion failed: (!CodeSynthesisContexts.empty() && "Cannot perform an instantiation without some context on the " "instantiation stack"), function SubstType, file clang/lib/Sema/SemaTemplateInstantiate.cpp, line 1580. Fix by avoiding deduction guide synthesis if InstantiatingTemplate is invalid. rdar://problem/39051732 Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46446 llvm-svn: 332307
* [analyzer] Re-apply r331096 "CStringChecker: Add support for BSD strlcpy()...".Artem Dergachev2018-05-141-54/+97
| | | | | | | | | | Fixed after revert in r331401. Patch by David Carlier! Differential Revision: https://reviews.llvm.org/D45177 llvm-svn: 332303
* [analyzer] Extend the ObjCAutoreleaseWriteChecker to warn on captures as wellGeorge Karpenkov2018-05-141-29/+51
| | | | | | | | | | A common pattern is that the code in the block does not write into the variable explicitly, but instead passes it to a helper function which performs the write. Differential Revision: https://reviews.llvm.org/D46772 llvm-svn: 332300
* [CodeView] Improve debugging of virtual base class member variablesBrock Wyma2018-05-141-2/+6
| | | | | | | | Initial support for passing the virtual base pointer offset to CodeViewDebug. https://reviews.llvm.org/D46271 llvm-svn: 332296
* Fix regression in r332076.Richard Smith2018-05-141-1/+11
| | | | | | | | | If the name after 'template' is an unresolved using declaration (not containing 'typename'), then we don't yet know if it's a valid template-name, so don't reject it prior to instantiation. Instead, treat it as naming a dependent member of the current instantiation. llvm-svn: 332291
* Remove the fixit for the diagnostics regarding capturing autoreleasing ↵George Karpenkov2018-05-141-24/+0
| | | | | | | | | | | | | | | variables in a block The fixit is actively harmful, as it encourages developers to ignore the warning and to write unsafe code. It is almost impossible to write safe code while capturing autoreleasing variables in the block, as in order to check that the block is never called in the autoreleasing pool the developer has to check the transitive closure of all potential callers of the block. Differential Revision: https://reviews.llvm.org/D46778 llvm-svn: 332288
* [Tooling] Pull #include manipulation code from clangFormat into libToolingCore.Eric Liu2018-05-143-394/+337
| | | | | | | | | | | | | | Summary: Also pull #include related style out of FormatStyle as tooling::IncludeStyle. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: klimek, mgorny, cfe-commits, djasper Differential Revision: https://reviews.llvm.org/D46496 llvm-svn: 332287
* PR37450: Fix bug that disabled some type checks for variables with deduced ↵Richard Smith2018-05-142-7/+21
| | | | | | | | types. Also improve diagnostic for the case where a type is non-literal because it's a lambda. llvm-svn: 332286
* [clang-format] Move #include related style to libToolingCoreEric Liu2018-05-143-34/+55
| | | | | | | | | | | | | | Summary: This will be shared by include insertion/deletion library. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: mgorny, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D46758 llvm-svn: 332284
* [AST] Print correct tag decl for tag specifierJoel E. Denny2018-05-147-14/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, given: void fn() { struct T *p0; struct T { int i; } *p1; } -ast-print produced: void fn() { struct T { int i; } *p0; struct T { int i; } *p1; } Compiling that fails with a redefinition error. Given: void fn() { struct T *p0; struct __attribute__((deprecated)) T *p1; } -ast-print dropped the attribute. Details: For a tag specifier (that is, struct/union/class/enum used as a type specifier in a declaration) that was also a tag declaration (that is, first occurrence of the tag) or tag redeclaration (that is, later occurrence that specifies attributes or a member list), clang printed the tag specifier as either (1) the full tag definition if one existed, or (2) the first tag declaration otherwise. Redefinition errors were sometimes introduced, as in the first example above. Even when that was impossible because no member list was ever specified, attributes were sometimes lost, thus changing semantics and diagnostics, as in the second example above. This patch fixes a major culprit for these problems. It does so by creating an ElaboratedType with a new OwnedDecl member wherever an occurrence of a tag type is a (re)declaration of that tag type. PrintingPolicy's IncludeTagDefinition used to trigger printing of the member list, attributes, etc. for a tag specifier by using a tag (re)declaration selected as described above. Now, it triggers the same thing except it uses the tag (re)declaration stored in the OwnedDecl. Of course, other tooling can now make use of the new OwnedDecl as well. Also, to be more faithful to the original source, this patch suppresses printing of attributes inherited from previous declarations. Reviewed by: rsmith, aaron.ballman Differential Revision: https://reviews.llvm.org/D45463 llvm-svn: 332281
* CodeGen: Emit string literal in constant address spaceYaxun Liu2018-05-143-12/+53
| | | | | | | | | Some targets have constant address space (e.g. amdgcn). For them string literal should be emitted in constant address space then casted to default address space. Differential Revision: https://reviews.llvm.org/D46643 llvm-svn: 332279
* [AST] Fix -ast-print for _Bool when have diagnosticsJoel E. Denny2018-05-142-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, given: #define bool _Bool _Bool i; void fn() { 1; } -ast-print produced: tmp.c:3:13: warning: expression result unused void fn() { 1; } ^ bool i; void fn() { 1; } That fails to compile because bool is undefined. Details: Diagnostics print _Bool as bool when the latter is defined as the former. However, diagnostics were altering the printing policy for -ast-print as well. The printed source was then invalid because the preprocessor eats the bool definition. Problematic diagnostics included suppressed warnings (e.g., add -Wno-unused-value to the above example), including those that are suppressed by default. This patch fixes this bug and cleans up some related comments. Reviewed by: aaron.ballman, rsmith Differential Revision: https://reviews.llvm.org/D45093 llvm-svn: 332275
* [X86] Use __builtin_convertvector to replace some of the avx512 truncate ↵Craig Topper2018-05-144-66/+56
| | | | | | | | | | builtins. As long as the destination type is a 256 or 128 bit vector with the same number of elements we can use __builtin_convertvector to directly generate trunc IR instruction which will be handled natively by the backend. Differential Revision: https://reviews.llvm.org/D46742 llvm-svn: 332266
* [CodeComplete] Provide completion in decls even for incomplete typesIlya Biryukov2018-05-141-4/+2
| | | | | | | | | | | | | | | | | | | | Summary: This change fixes lack of completions in the following case ('^'designates completion points) : void f(^); struct Incomplete; Incomplete g(^); Reviewers: bkramer, aaron.ballman, sammccall Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46639 llvm-svn: 332244
* Revert "[CodeGen] Disable aggressive structor optimizations at -O0"Pavel Labath2018-05-141-10/+6
| | | | | | | | | It breaks the sanitizer build <http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/23739> This reverts commit r332228. llvm-svn: 332232
* [CodeGen] Disable aggressive structor optimizations at -O0Pavel Labath2018-05-141-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Removing the full structor and replacing all usages with the base one can degrade debug quality as it will leave the debugger unable to locate the full object structor. This is apparent when evaluating an expression in the debugger which requires constructing an object of class which has had this optimization applied to it. When compiling the expression, we pretend that the class and its methods have been defined in another compilation unit, so the expression compiler assumes the structor definition must be available. This didn't use to be the case for structors with internal linkage. Less aggressive optimizations like emitting the full structor as an alias remain in place, as they do not cause the structor symbol to disappear completely. This improves debug quality on non-darwin platforms (darwin does not have -mconstructor-aliases on by default, so it is spared these problems) and enable us to remove some workarounds from LLDB which attempt to mitigate this issue. Reviewers: rjmccall, aprantl Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46685 llvm-svn: 332228
* [clang-format] Continue after non-scope-closers in getLengthToMatchingParenKrasimir Georgiev2018-05-141-1/+3
| | | | | | | | | | | | | Summary: This fixes a regression introduced by `r331857` where we stop the search for the End token as soon as we hit a non-scope-closer, which prematurely stops before semicolons for example, which should otherwise be considered as part of the unbreakable tail. Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D46824 llvm-svn: 332225
* [X86] Use select instrution and fpextend in the implementation of ↵Craig Topper2018-05-141-9/+6
| | | | | | _mm512_mask_cvtps_pd and _mm512_maskz_cvtps_pd. llvm-svn: 332213
* [X86] Use __builtin_convertvector to implement _mm512_cvtps_pd.Craig Topper2018-05-141-5/+1
| | | | | | | | If we're using default rounding mode we can let __builtin_convertvector to generate an fpextend. This matches 128 and 256 bit. If we're using the version that takes an explicit rounding mode argument we would need to look at the immediate to see if its CUR_DIRECTION. llvm-svn: 332210
* [X86] Emit better code for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and ↵Craig Topper2018-05-131-7/+8
| | | | | | | | | | _mm_cvtu64_ss. We can use direct C code for these that will use uitofp and insertelement instructions. For the versions that take an explicit rounding mode we can't do this. llvm-svn: 332203
* Added atomic_fetch_min, max, umin, umax intrinsics to clang.Elena Demikhovsky2018-05-133-2/+28
| | | | | | | | | These intrinsics work exactly as all other atomic_fetch_* intrinsics and allow to create *atomicrmw* with ordering. Updated the clang-extensions document. Differential Revision: https://reviews.llvm.org/D46386 llvm-svn: 332193
* Force the PS4 clang ABI version to 6.Douglas Yung2018-05-121-0/+10
| | | | | | | | | | | | The PS4 requires clang ABI version 6 for compatibility reasons. This change forces this and if the user specifies a different version when the PS4 target is specified, the compiler emits a warning that the specified version is being ignored. Reviewers: probinson Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46767 llvm-svn: 332160
* [Driver] Only use -lc++ on FuchsiaPetr Hosek2018-05-111-2/+0
| | | | | | | | | The fact that libc++ depends on libc++abi and libunwind is an internal detail that's captured by the libc++.so linker script. Differential Revision: https://reviews.llvm.org/D46768 llvm-svn: 332138
* [analyzer] Ignore the nullability quantifiers for autoreleasewritecheckerGeorge Karpenkov2018-05-111-2/+2
| | | | llvm-svn: 332136
* [OPENMP, NVPTX] Do not use SPMD mode for target simd and target teamsAlexey Bataev2018-05-111-19/+13
| | | | | | | | | distribute simd directives. Directives `target simd` and `target teams distribute simd` must be executed in non-SPMD mode. llvm-svn: 332129
* [HIP] Set proper triple and offload kind for the toolchainYaxun Liu2018-05-112-10/+42
| | | | | | | | Also introduce --hip-link option to indicate HIP for linking. Differential Revision: https://reviews.llvm.org/D46475 llvm-svn: 332123
* [HIP] Diagnose unsupported host tripleYaxun Liu2018-05-111-3/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D46487 llvm-svn: 332122
* [HIP] Let clang-offload-bundler support HIPYaxun Liu2018-05-112-3/+15
| | | | | | | | | | When bundle/unbundle intermediate files for HIP, there may be multiple sub archs, therefore BoundArch needs to be included in the target and output file names for clang-offload-bundler. Differential Revision: https://reviews.llvm.org/D46473 llvm-svn: 332121
* [X86] Fix the file header name on fmaintrin.hCraig Topper2018-05-111-1/+1
| | | | llvm-svn: 332108
* [Hexagon] Implement checking arguments of builtin callsKrzysztof Parzyszek2018-05-111-0/+223
| | | | llvm-svn: 332105
* [X86] Assume alignment of movdir64b dst argumentGabor Buella2018-05-111-2/+7
| | | | | | | | | | Reviewers: craig.topper Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D46683 llvm-svn: 332091
* Improve diagnostics and error recovery for template name lookup.Richard Smith2018-05-115-81/+128
| | | | | | | | | | | | | For 'x::template y', consistently give a "no member named 'y' in 'x'" diagnostic if there is no such member, and give a 'template keyword not followed by a template' name error if there is such a member but it's not a template. In the latter case, add a note pointing at the non-template. Don't suggest inserting a 'template' keyword in 'X::Y<' if X is dependent if the lookup of X::Y was actually not a dependent lookup and found only non-templates. llvm-svn: 332076
* Don't propagate dllimport to base class template static data membersReid Kleckner2018-05-111-0/+17
| | | | | | MSVC doesn't, so we shouldn't. Fixes PR37232. llvm-svn: 332074
* Support XRay in the NetBSD driverKamil Rytarowski2018-05-111-20/+25
| | | | | | | | | | | | | | | | | | | | Summary: While there, perform a small cleanup, reducing delta with drivers for other OSes. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, dberris Reviewed By: dberris Subscribers: llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D46721 llvm-svn: 332071
* Permit -fxray-instrument for NetBSD/amd64Kamil Rytarowski2018-05-111-1/+2
| | | | | | | | | | | | | | | | | Summary: Use the same branch as FreeBSD and OpenBSD. Sponsored by <The NetBSD Foundation> Reviewers: joerg, dberris, vitalybuka Reviewed By: vitalybuka Subscribers: emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D46737 llvm-svn: 332070
* [Itanium] Emit type info names with external linkage.Eric Fiselier2018-05-101-58/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The Itanium ABI requires that the type info for pointer-to-incomplete types to have internal linkage, so that it doesn't interfere with the type info once completed. Currently it also marks the type info name as internal as well. However, this causes a bug with the STL implementations, which use the type info name pointer to perform ordering and hashing of type infos. For example: ``` // header.h struct T; extern std::type_info const& Info; // tu_one.cpp #include "header.h" std::type_info const& Info = typeid(T*); // tu_two.cpp #include "header.h" struct T {}; int main() { auto &TI1 = Info; auto &TI2 = typeid(T*); assert(TI1 == TI2); // Fails assert(TI1.hash_code() == TI2.hash_code()); // Fails } ``` This patch fixes the STL bug by emitting the type info name as linkonce_odr when the type-info is for a pointer-to-incomplete type. Note that libc++ could fix this without a compiler change, but the quality of fix would be poor. The library would either have to: (A) Always perform strcmp/string hashes. (B) Determine if we have a pointer-to-incomplete type, and only do strcmp then. This would require an ABI break for libc++. Reviewers: rsmith, rjmccall, majnemer, vsapsai Reviewed By: rjmccall Subscribers: smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D46665 llvm-svn: 332028
* Reland '[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective'Julie Hockett2018-05-109-30/+45
| | | | | | | | | | | | | | This commit relands r331904. Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective in PPCallbacks, and updating calls to that function. This will be useful in https://reviews.llvm.org/D43778 to determine which includes are system headers. Differential Revision: https://reviews.llvm.org/D46614 llvm-svn: 332021
* Allow dllimport non-type template arguments in C++17Reid Kleckner2018-05-102-22/+42
| | | | | | | | | | | Summary: Fixes PR35772. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D43320 llvm-svn: 332018
* [OPENMP, NVPTX] Initial support for L2 parallelism in SPMD mode.Alexey Bataev2018-05-102-61/+176
| | | | | | | | Added initial support for L2 parallelism in SPMD mode. Note, though, that the orphaned parallel directives are not currently supported in SPMD mode. llvm-svn: 332016
* This patch provides that bitfields are splitted even in caseStrahinja Petrovic2018-05-101-10/+12
| | | | | | | | when current field is not legal integer type. Differential Revision: https://reviews.llvm.org/D39053 llvm-svn: 331979
* Add support of the next Ubuntu (Ubuntu 18.10 - Cosmic Canimal)Sylvestre Ledru2018-05-101-0/+1
| | | | | | Patch by Adam Conrad llvm-svn: 331965
* Revert "[Itanium] Emit type info names with external linkage."Eric Fiselier2018-05-101-63/+58
| | | | | | | This reverts commit r331957. It seems to be causing failures on ppc64le-linux. llvm-svn: 331963
* [X86] ptwrite intrinsicGabor Buella2018-05-107-0/+68
| | | | | | | | | | Reviewers: craig.topper, RKSimon Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D46540 llvm-svn: 331962
OpenPOWER on IntegriCloud