summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [CodeComplete] #include completion treats -I as non-system (require ↵Sam McCall2018-10-011-1/+1
| | | | | | header-like extension). llvm-svn: 343457
* Use the container form llvm::sort(C, ...)Fangrui Song2018-09-301-2/+2
| | | | | | | | | There are a few leftovers of rC343147 that are not (\w+)\.begin but in the form of ([-[:alnum:]>.]+)\.begin or spanning two lines. Change them to use the container form in this commit. The 12 occurrences have been inspected manually for safety. llvm-svn: 343425
* [OPENMP]Fix PR39084: Check datasharing attributes of reduction variables only.Alexey Bataev2018-09-281-60/+58
| | | | | | | | According to OpenMP, the reduction item must be shared in parent region. But the item can be an array section or array subscript. In this case, we should not check for the datasharing of the base declaration. llvm-svn: 343356
* [cxx2a] P0614R1: Support init-statements in range-based for loops.Richard Smith2018-09-282-35/+56
| | | | | | | We don't yet support this for the case where a range-based for loop is implicitly rewritten to an ObjC for..in statement. llvm-svn: 343350
* Handle dependent class template names in class template argumentRichard Smith2018-09-281-1/+4
| | | | | | deduction for new-expressions. llvm-svn: 343293
* [cxx2a] P0641R2: (Some) type mismatches on defaulted functions onlyRichard Smith2018-09-281-13/+46
| | | | | | | | | | | | | | | | render the function deleted instead of rendering the program ill-formed. This change also adds an enabled-by-default warning for the case where an explicitly-defaulted special member function of a non-template class is implicitly deleted by the type checking rules. (This fires either due to this language change or due to pre-C++20 reasons for the member being implicitly deleted). I've tested this on a large codebase and found only bugs (where the program means something that's clearly different from what the programmer intended), so this is enabled by default, but we should revisit this if there are problems with this being enabled by default. llvm-svn: 343285
* [cxx2a] P0624R2: Lambdas with no capture-default areRichard Smith2018-09-272-1/+13
| | | | | | default-constructible and assignable. llvm-svn: 343279
* Test commit. NFCPatrick Lyster2018-09-271-1/+1
| | | | llvm-svn: 343258
* [Sema] Handle __va_start for Windows/ARM64 in the same way as for ARMMartin Storsjo2018-09-271-0/+1
| | | | | | | | This fixes PR39090. Differential Revision: https://reviews.llvm.org/D52571 llvm-svn: 343184
* llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)Fangrui Song2018-09-265-8/+5
| | | | | | | | | | | | | | Summary: The convenience wrapper in STLExtras is available since rL342102. Reviewers: rsmith, #clang, dblaikie Reviewed By: rsmith, #clang Subscribers: mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52576 llvm-svn: 343147
* P1008R1 Classes with user-declared constructors are never aggregates inRichard Smith2018-09-261-3/+32
| | | | | | C++20. llvm-svn: 343131
* P0859R0: List-initialization is potentially-constant-evaluated andRichard Smith2018-09-261-9/+32
| | | | | | | | | | | | triggers instantiation of constexpr functions. We mostly implemented this since Clang 6, but missed the template instantiation case. We do not implement the '&cast-expression' special case. It appears to be a mistake / oversight. I've mailed CWG to see if we can remove it. llvm-svn: 343064
* [OPENMP] Add support for OMP5 requires directive + unified_address clauseKelvin Li2018-09-263-1/+88
| | | | | | | | | Add support for OMP5.0 requires directive and unified_address clause. Patches to follow will include support for additional clauses. Differential Revision: https://reviews.llvm.org/D52359 llvm-svn: 343063
* [Sema] Use a more civilized hash map to implement -Wduplicate-enum.Erik Pilkington2018-09-251-1/+1
| | | | | | | | | DenseMap<long, SOMETHING> used LONG_MAX as a tombstone, so it asserts when you try to insert it! rdar://44774672 llvm-svn: 343042
* P0969R0: allow structured binding of accessible members, not only public ↵Richard Smith2018-09-253-44/+51
| | | | | | members. llvm-svn: 343036
* [OpenCL] Allow zero assignment and comparisons between queue_t type variablesSven van Haastregt2018-09-251-0/+11
| | | | | | | | | | | This change allows for zero assignment and comparison of queue_t type variables, and extends null_queue.cl to test this. Patch by Alistair Davies. Differential Revision: https://reviews.llvm.org/D51727 llvm-svn: 342968
* P0962R1: only use the member form of 'begin' and 'end' in a range-basedRichard Smith2018-09-241-51/+95
| | | | | | | | | | for loop if both members exist. This resolves a DR whereby an errant 'begin' or 'end' member in a base class could result in a derived class not being usable as a range with non-member 'begin' and 'end'. llvm-svn: 342925
* Revert "We allow implicit function declarations as an extension in all C ↵Anastasia Stulova2018-09-241-3/+5
| | | | | | | | | | dialects. Remove OpenCL special case." Discussed on cfe-commits (Week-of-Mon-20180820), this change leads to the generation of invalid IR for OpenCL without giving an error. Therefore, the conclusion was to revert. llvm-svn: 342885
* Fix Wundef NDEBUG warning; NFCSven van Haastregt2018-09-241-1/+1
| | | | | | | Check for definedness of the NDEBUG macro rather than its value, to be consistent with other uses. llvm-svn: 342876
* Update smart pointer detection for thread safety analysis.Richard Trieu2018-09-221-8/+27
| | | | | | | | | Objects are determined to be smart pointers if they have both a star and arrow operator. Some implementations of smart pointers have these overloaded operators in a base class, while the check only searched the derived class. This fix will also look for the operators in the base class. llvm-svn: 342794
* [CUDA] Ignore uncallable functions when we check for usual deallocators.Artem Belevich2018-09-212-2/+25
| | | | | | | | | Previously clang considered function variants from both sides of compilation and that resulted in picking up wrong deallocation function. Differential Revision: https://reviews.llvm.org/D51808 llvm-svn: 342749
* [OPENMP] Disable emission of the class with vptr if they are not used inAlexey Bataev2018-09-211-1/+2
| | | | | | | | | target constructs. Prevent compilation of the classes with the virtual tables when compiling for the device. llvm-svn: 342741
* [AST] Various optimizations + refactoring in DeclarationName(Table)Bruno Ricci2018-09-211-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce the following optimizations in DeclarationName(Table): 1. Store common kinds inline in DeclarationName instead of DeclarationNameExtra. Currently the kind of C++ constructor, destructor, conversion function and overloaded operator names is stored in DeclarationNameExtra. Instead store it inline in DeclarationName. To do this align IdentifierInfo, CXXSpecialName, DeclarationNameExtra and CXXOperatorIdName to 8 bytes so that we can use the lower 3 bits of DeclarationName::Ptr. This is already the case on 64 bits archs anyway. This also allow us to remove DeclarationNameExtra from CXXSpecialName and CXXOperatorIdName, which shave off a pointer from CXXSpecialName. 2. Synchronize the enumerations DeclarationName::NameKind, DeclarationName::StoredNameKind and Selector::IdentifierInfoFlag. This makes DeclarationName::getNameKind much more efficient since we can replace the switch table by a single comparison and an addition. 3. Put the overloaded operator names inline in DeclarationNameTable to remove an indirection. This increase the size of DeclarationNameTable a little bit but this is not important since it is only used in ASTContext, and never copied nor moved from. This also get rid of the last dynamic allocation in DeclarationNameTable. Altogether these optimizations cut the run time of parsing all of Boost by about 0.8%. While we are at it, do the following NFC modifications: 1. Put the internal classes CXXSpecialName, CXXDeductionGuideNameExtra, CXXOperatorIdName, CXXLiteralOperatorIdName and DeclarationNameExtra in a namespace detail since these classes are only meant to be used by DeclarationName and DeclarationNameTable. Make this more explicit by making the members of these classes private and friending DeclarationName(Table). 2. Make DeclarationName::getFETokenInfo a non-template since every users are using it to get a void *. It was supposed to be used with a type to avoid a subsequent static_cast. 3. Change the internal functions DeclarationName::getAs* to castAs* since when we use them we already know the correct kind. This has no external impact since all of these are private. Reviewed By: erichkeane, rjmccall Differential Revision: https://reviews.llvm.org/D52267 llvm-svn: 342729
* [Sema] Retain __restrict qualifiers when substituting a reference type.Erik Pilkington2018-09-201-3/+9
| | | | | | | | Fixes rdar://43760099 Differential revision: https://reviews.llvm.org/D52271 llvm-svn: 342672
* [OPENMP] Add support for mapping memory pointed by member pointer.Alexey Bataev2018-09-201-0/+20
| | | | | | Added support for map(s, s.ptr[0:1]) kind of mapping. llvm-svn: 342648
* [OpenCL] Diagnose redundant address space conversionSven van Haastregt2018-09-201-0/+7
| | | | | | | | | | | | | | | | Add a warning if a parameter with a named address space is passed to a to_addr builtin. For example: int i; to_private(&i); // generate warning as conversion from private to private is redundant. Patch by Alistair Davies. Differential Revision: https://reviews.llvm.org/D51411 llvm-svn: 342638
* [PowerPC] [Clang] Add vector int128 pack/unpack builtinsQingShan Zhang2018-09-201-0/+12
| | | | | | | | | | | | unsigned long long builtin_unpack_vector_int128 (vector int128_t, int); vector int128_t builtin_pack_vector_int128 (unsigned long long, unsigned long long); Builtins should behave the same way as in GCC. Patch By: wuzish (Zixuan Wu) Differential Revision: https://reviews.llvm.org/D52074 llvm-svn: 342614
* Thread Safety Analysis: warnings for attributes without argumentsAaron Puchert2018-09-201-16/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When thread safety annotations are used without capability arguments, they are assumed to apply to `this` instead. So we warn when either `this` doesn't exist, or the class is not a capability type. This is based on earlier work by Josh Gao that was committed in r310403, but reverted in r310698 because it didn't properly work in template classes. See also D36237. The solution is not to go via the QualType of `this`, which is then a template type, hence the attributes are not known because it could be specialized. Instead we look directly at the class in which we are contained. Additionally I grouped two of the warnings together. There are two issues here: the existence of `this`, which requires us to be a non-static member function, and the appropriate annotation on the class we are contained in. So we don't distinguish between not being in a class and being static, because in both cases we don't have `this`. Fixes PR38399. Reviewers: aaron.ballman, delesley, jmgao, rtrieu Reviewed By: delesley Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51901 llvm-svn: 342605
* [Sema] Do not load macros from preamble when LoadExternal is false.Eric Liu2018-09-191-13/+16
| | | | | | | | | | | | Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52079 llvm-svn: 342528
* [CodeComplete] Add completions for filenames in #include directives.Sam McCall2018-09-182-1/+116
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: The dir component ("somedir" in #include <somedir/fo...>) is considered fixed. We append "foo" to each directory on the include path, and then list its files. Completions are of the forms: #include <somedir/fo^ foo.h> fox/ The filter is set to the filename part ("fo"), so fuzzy matching can be applied to the filename only. No fancy scoring/priorities are set, and no information is added to CodeCompleteResult to make smart scoring possible. Could be in future. Reviewers: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52076 llvm-svn: 342449
* [OpenCL] Allow blocks to capture arrays in OpenCLAndrew Savonichev2018-09-171-2/+4
| | | | | | | | | | | | | | Summary: Patch by Egor Churaev Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: asavonic, bader, cfe-commits Differential Revision: https://reviews.llvm.org/D51722 llvm-svn: 342370
* Merge two attribute diagnostics into oneAndrew Savonichev2018-09-172-2/+3
| | | | | | | | | | | | | | | | | | Summary: Merged the recently added `err_attribute_argument_negative` diagnostic with existing `err_attribute_requires_positive_integer` diagnostic: the former allows only strictly positive integer, while the latter also allows zero. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51853 llvm-svn: 342367
* [modules] Don't bother creating a global module fragment when building aRichard Smith2018-09-151-1/+3
| | | | | | header module. llvm-svn: 342307
* [modules] Frontend support for building a header module from a list ofRichard Smith2018-09-152-2/+21
| | | | | | headaer files. llvm-svn: 342304
* [clang] Make sure attributes on member classes are applied properlyLouis Dionne2018-09-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: Attributes on member classes of class templates and member class templates of class templates are not currently instantiated. This was discovered by Richard Smith here: http://lists.llvm.org/pipermail/cfe-dev/2018-September/059291.html This commit makes sure that attributes are instantiated properly. This commit does not fix the broken behavior for member partial and explicit specializations of class templates. PR38913 Reviewers: rsmith Subscribers: dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D51997 llvm-svn: 342238
* [Sema] Remove location from implicit capture init exprVedant Kumar2018-09-131-6/+7
| | | | | | | | | | | | | | | | | | A lambda's closure is initialized when the lambda is declared. For implicit captures, the initialization code emitted from EmitLambdaExpr references source locations *within the lambda body* in the function containing the lambda. This results in a poor debugging experience: we step to the line containing the lambda, then into lambda, out again, over and over, until every capture's field is initialized. To improve stepping behavior, assign the starting location of the lambda to expressions which initialize an implicit capture within it. rdar://39807527 Differential Revision: https://reviews.llvm.org/D50927 llvm-svn: 342194
* [OPENMP] Fix PR38903: Crash on instantiation of the non-dependentAlexey Bataev2018-09-132-32/+57
| | | | | | | | | | | declare reduction. If the declare reduction construct with the non-dependent type is defined in the template construct, the compiler might crash on the template instantition. Reworked the whole instantiation scheme for the declare reduction constructs to fix this problem correctly. llvm-svn: 342151
* Remove dead code made unnecessary by r342018.Richard Smith2018-09-121-7/+0
| | | | llvm-svn: 342098
* Track definition merging on the canonical declaration even when localRichard Smith2018-09-121-1/+8
| | | | | | | | | | | | | | submodule visibility is disabled. Attempting to pick a specific declaration to make visible when the module containing the merged declaration becomes visible is error-prone, as we don't yet know which declaration we'll choose to be the definition when we are informed of the merging. This reinstates r342019, reverted in r342020. The regression previously observed after this commit was fixed in r342096. llvm-svn: 342097
* [OPENMP] Fix PR38902: support ADL for declare reduction constructs.Alexey Bataev2018-09-121-1/+106
| | | | | | | Added support for argument-dependent lookup when trying to find the required declare reduction decl. llvm-svn: 342062
* Revert r342019, "Track definition merging on the canonical declarationRichard Smith2018-09-121-8/+1
| | | | | | | | | even when [...]" Further testing has revealed that this causes build breaks during explicit module compilations. llvm-svn: 342020
* Track definition merging on the canonical declaration even when localRichard Smith2018-09-121-1/+8
| | | | | | | | | | | submodule visibility is disabled. Attempting to pick a specific declaration to make visible when the module containing the merged declaration becomes visible is error-prone, as we don't yet know which declaration we'll choose to be the definition when we are informed of the merging. llvm-svn: 342019
* Consistently create a new declaration when merging a pre-existing butRichard Smith2018-09-126-75/+113
| | | | | | | | | | | | | | | | hidden definition with a would-be-parsed redefinition. This permits a bunch of cleanups. In particular, we no longer need to take merged definitions into account when checking declaration visibility, only when checking definition visibility, which makes certain visibility checks take linear instead of quadratic time. We could also now remove the UPD_DECL_EXPORTED update record and track on each declaration whether it was demoted from a definition (as we already do for variables), but I'm not doing that in this patch to keep the changes here simpler. llvm-svn: 342018
* [CodeCompletion] Enable signature help when initializing class/struct/union ↵Kadir Cetinkaya2018-09-112-15/+45
| | | | | | | | | | | | | | | | | | | | members. Summary: Factors out member decleration gathering and uses it in parsing to call signature help. Doesn't support signature help for base class constructors, the code was too coupled with diagnostic handling, but still can be factored out but just needs more afford. Reviewers: sammccall, ilya-biryukov, ioeric Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51917 llvm-svn: 341949
* [OPENMP] Simplified checks for declarations in declare target regions.Alexey Bataev2018-09-111-106/+36
| | | | | | | | Sema analysis should not mark functions as an implicit declare target, it may break codegen. Simplified semantic analysis and removed extra code for implicit declare target functions. llvm-svn: 341939
* [Sema][ObjC] Infer availability of +new from availability of -init.Erik Pilkington2018-09-103-13/+47
| | | | | | | | | | | When defined in NSObject, +new will call -init. If -init has been marked unavailable, diagnose uses of +new. rdar://18335828 Differential revision: https://reviews.llvm.org/D51189 llvm-svn: 341874
* Implement -Watomic-implicit-seq-cstJF Bastien2018-09-101-17/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: _Atomic and __sync_* operations are implicitly sequentially-consistent. Some codebases want to force explicit usage of memory order instead. This warning allows them to know where implicit sequentially-consistent memory order is used. The warning isn't on by default because _Atomic was purposefully designed to have seq_cst as the default: the idea was that it's the right thing to use most of the time. This warning allows developers who disagree to enforce explicit usage instead. A follow-up patch will take care of C++'s std::atomic. It'll be different enough from this patch that I think it should be separate: for C++ the atomic operations all have a memory order parameter (or two), but it's defaulted. I believe this warning should trigger when the default is used, but not when seq_cst is used explicitly (or implicitly as the failure order for cmpxchg). <rdar://problem/28172966> Reviewers: rjmccall Subscribers: dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D51084 llvm-svn: 341860
* Enhance -Wc++14-compat for class template argument deduction to list theRichard Smith2018-09-101-6/+11
| | | | | | deduced type (if known). llvm-svn: 341858
* Prevent cpu-specific/cpu-dispatch from giong on a lambda.Erich Keane2018-09-101-0/+8
| | | | | | | It is non-sensical to use cpu-specific/cpu-dispatch multiversioning on a lambda, so prevent it when trying to add the attribute. llvm-svn: 341833
* [clang] Make sure codecompletion is called for calls even when inside a token.Kadir Cetinkaya2018-09-101-0/+4
| | | | | | | | | | | | | | | | | Summary: Currently CodeCompleteCall only gets called after a comma or parantheses. This patch makes sure it is called even at the cases like: ```foo(1^);``` Reviewers: ilya-biryukov, ioeric, hokein Reviewed By: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51038 llvm-svn: 341824
OpenPOWER on IntegriCloud