summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* PR33222: Require the declared return type not the actual return type toRichard Smith2018-09-103-9/+7
| | | | | | | | | match when checking for redeclaration of a function template. This properly handles differences in deduced return types, particularly when performing redeclaration checks for a friend function template. llvm-svn: 341778
* Part of PR33222: defer enforcing return type mismatch for dependentRichard Smith2018-09-101-19/+60
| | | | | | friend function declarations of class templates. llvm-svn: 341775
* [OpenMP] Add support for nested 'declare target' directivesKelvin Li2018-09-101-8/+3
| | | | | | | | | | | Add the capability to nest multiple declare target directives - including header files within a declare target region. Differential Revision: https://reviews.llvm.org/D51378 Patch by Patrick Lyster llvm-svn: 341766
* [Sema] Make typo correction slightly more efficientFangrui Song2018-09-091-2/+2
| | | | | | edit_distance returns UpperBound+1 if the distance will exceed UpperBound. We can subtract 1 from UpperBound and change >= to > in the if condition. The threshold does not change but edit_distance will have more opportunity to bail out earlier. llvm-svn: 341763
* Revert r341754.Akira Hatanaka2018-09-094-61/+31
| | | | | | | | | The commit broke a couple of bots: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/12347 http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/7310 llvm-svn: 341757
* Distinguish `__block` variables that are captured by escaping blocksAkira Hatanaka2018-09-084-31/+61
| | | | | | | | | | | | | | | | | | | | | | | | from those that aren't. This patch changes the way __block variables that aren't captured by escaping blocks are handled: - Since non-escaping blocks on the stack never get copied to the heap (see https://reviews.llvm.org/D49303), Sema shouldn't error out when the type of a non-escaping __block variable doesn't have an accessible copy constructor. - IRGen doesn't have to use the specialized byref structure (see https://clang.llvm.org/docs/Block-ABI-Apple.html#id8) for a non-escaping __block variable anymore. Instead IRGen can emit the variable as a normal variable and copy the reference to the block literal. Byref copy/dispose helpers aren't needed either. rdar://problem/39352313 Differential Revision: https://reviews.llvm.org/D51564 llvm-svn: 341754
* [CodeComplete] Clearly distinguish signature help and code completion.Ilya Biryukov2018-09-071-40/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Code completion in clang is actually a mix of two features: - Code completion is a familiar feature. Results are exposed via the CodeCompleteConsumer::ProcessCodeCompleteResults callback. - Signature help figures out if the current expression is an argument of some function call and shows corresponding signatures if so. Results are exposed via CodeCompleteConsumer::ProcessOverloadCandidates. This patch refactors the implementation to untangle those two from each other and makes some naming tweaks to avoid confusion when reading the code. The refactoring is required for signature help fixes, see D51038. The only intended behavior change is the order of callbacks. ProcessOverloadCandidates is now called before ProcessCodeCompleteResults. Reviewers: sammccall, kadircet Reviewed By: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51782 llvm-svn: 341660
* [Sema] Check that the destructor for each element of class type isAkira Hatanaka2018-09-071-1/+78
| | | | | | | | | | accessible from the context where aggregate initialization occurs. rdar://problem/38168772 Differential Revision: https://reviews.llvm.org/D45898 llvm-svn: 341629
* Remove deprecated APIStephen Kelly2018-09-061-8/+0
| | | | | | | | | | Reviewers: teemperor! Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50353 llvm-svn: 341573
* [OPENMP] Fix PR38823: Do not emit vtable if it is not used in targetAlexey Bataev2018-09-061-0/+5
| | | | | | | | | | | context. If the explicit template instantiation definition defined outside of the target context, its vtable should not be marked as used. This is true for other situations where the compiler want to emit vtables unconditionally. llvm-svn: 341570
* [Sema] Clean up some __builtin_*_chk diagnosticsErik Pilkington2018-09-061-8/+34
| | | | | | | | | | | Namely, print the likely macro name when it's used, and include the actual computed sizes in the diagnostic message, which are sometimes not obvious. rdar://43909200 Differential revision: https://reviews.llvm.org/D51697 llvm-svn: 341566
* Remove unnecessary semicolon to silence -Wpedantic warning. NFCI.Simon Pilgrim2018-09-061-1/+1
| | | | llvm-svn: 341556
* [OpenCL] Relax diagnostics on OpenCL access qualifiersAndrew Savonichev2018-09-062-16/+42
| | | | | | | | | | | | | | | | | Summary: Emit warning for multiple access qualifiers if they do not conflict. Patch by Alexey Bader Reviewers: Anastasia, yaxunl Reviewed By: Anastasia Subscribers: asavonic, bader, cfe-commits Differential Revision: https://reviews.llvm.org/D51302 llvm-svn: 341553
* [OpenCL] Disallow negative attribute argumentsAndrew Savonichev2018-09-061-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Negative arguments in kernel attributes are silently bitcast'ed to unsigned, for example: __attribute__((reqd_work_group_size(1, -1, 1))) __kernel void k() {} is a complete equivalent of: __attribute__((reqd_work_group_size(1, 4294967294, 1))) __kernel void k() {} This is likely an error, so the patch forbids negative arguments in several OpenCL attributes. Users who really want 4294967294 can still use it as an unsigned representation. Reviewers: Anastasia, yaxunl, bader Reviewed By: Anastasia, yaxunl, bader Subscribers: bader, cfe-commits Differential Revision: https://reviews.llvm.org/D50259 llvm-svn: 341539
* PR38627: Fix handling of exception specification adjustment forRichard Smith2018-09-056-45/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | destructors. We previously tried to patch up the exception specification after completing the class, which went wrong when the exception specification was needed within the class body (in particular, by a friend redeclaration of the destructor in a nested class). We now mark the destructor as having a not-yet-computed exception specification immediately after creating it. This requires delaying various checks against the exception specification (where we'd previously have just got the wrong exception specification, and now find we have an exception specification that we can't compute yet) when those checks fire while the class is being defined. This also exposed an issue that we were missing a CodeSynthesisContext for computation of exception specifications (otherwise we'd fail to make the module containing the definition of the class visible when computing its members' exception specs). Adding that incidentally also gives us a diagnostic quality improvement. This has also exposed an pre-existing problem: making the exception specification evaluation context a non-SFINAE context (as it should be) results in a bootstrap failure; PR38850 filed for this. llvm-svn: 341499
* Forbid address spaces on compound literals in local scope.John McCall2018-09-051-6/+14
| | | | | | Patch by Bevin Hansson! llvm-svn: 341491
* [Sema] Don't warn about omitting unavailable enum constants in a switchErik Pilkington2018-09-051-1/+15
| | | | | | | | rdar://42717026 Differential revision: https://reviews.llvm.org/D51649 llvm-svn: 341490
* Add -Wobjc-property-assign-on-object-type.John McCall2018-09-051-0/+8
| | | | | | | | | | | | This is a warning about using 'assign' instead of 'unsafe_unretained' in Objective-C property declarations. It's off by default because there isn't consensus in the Objective-C steering group that this is the right thing to do, but we're nonetheless okay with adding it because there's a substantial pool of Objective-C programmers who will appreciate the warning. Patch by Alfred Zien! llvm-svn: 341489
* [Sema] Store MacroInfo in CodeCompletionResult for macro results.Eric Liu2018-09-051-7/+7
| | | | | | | | | | | | | | Summary: This provides information about the macro definition. For example, it can be used to compute macro USRs. Reviewers: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51675 llvm-svn: 341476
* Fix -Wdocumentation warning. NFCI.Simon Pilgrim2018-09-051-1/+1
| | | | llvm-svn: 341460
* [OpenCL] Traverse vector types for ocl extensions supportAlexey Sotkin2018-09-031-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Given the following kernel: __kernel void foo() { double d; double4 dd; } and cl_khr_fp64 is disabled, the compilation would fail due to the presence of 'double d', but when removed, it passes. The expectation is that extended vector types of unsupported types will also be unsupported. The patch adds the check for this scenario. Patch by: Ofir Cohen Reviewers: bader, Anastasia, AlexeySotkin, yaxunl Reviewed By: Anastasia Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51296 llvm-svn: 341309
* [X86] Add kshift intrinsics to match gcc and icc.Craig Topper2018-08-311-0/+8
| | | | | | | | | | | | | | This adds the following intrinsics: _kshiftli_mask8 _kshiftli_mask16 _kshiftli_mask32 _kshiftli_mask64 _kshiftri_mask8 _kshiftri_mask16 _kshiftri_mask32 _kshiftri_mask64 llvm-svn: 341234
* Add missing -Wc++11-compat / -Wc++14-compat warnings for:Richard Smith2018-08-302-11/+29
| | | | | | | | * generic lambdas * return type deduction * class template argument deduction llvm-svn: 341098
* [Sema][NFC] Trivial cleanup in ActOnCallExprJan Korous2018-08-301-7/+1
| | | | | | | | Use logical or operator instead of a bool variable and if/else. Differential Revision: https://reviews.llvm.org/D51485 llvm-svn: 341074
* [CodeComplete] Report location of opening parens for signature helpIlya Biryukov2018-08-302-21/+25
| | | | | | | | | | | | | | Summary: Used in clangd. Reviewers: sammccall Reviewed By: sammccall Subscribers: ioeric, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51436 llvm-svn: 341063
* [Sema/Attribute] Make types declared with address_space an AttributedTypeLeonard Chan2018-08-271-11/+19
| | | | | | | | | | | | | | | Currently an address_space is stored in a qualifier. This makes any type declared with an address_space attribute in the form `__attribute__((address_space(1))) int 1;` be wrapped in an AttributedType. This is for a later patch where if `address_space` is declared in a macro, any diagnostics that would normally print the address space will instead dump the macro name. This will require saving any macro information in the AttributedType. Differential Revision: https://reviews.llvm.org/D51229 llvm-svn: 340765
* Address Aaron Ballman's post-commit review comments from r340306, NFCErik Pilkington2018-08-211-4/+3
| | | | llvm-svn: 340311
* Add a new flag and attributes to control static destructor registrationErik Pilkington2018-08-212-0/+22
| | | | | | | | | | | | | | | | | | | | This commit adds the flag -fno-c++-static-destructors and the attributes [[clang::no_destroy]] and [[clang::always_destroy]]. no_destroy specifies that a specific static or thread duration variable shouldn't have it's destructor registered, and is the default in -fno-c++-static-destructors mode. always_destroy is the opposite, and is the default in -fc++-static-destructors mode. A variable whose destructor is disabled (either because of -fno-c++-static-destructors or [[clang::no_destroy]]) doesn't count as a use of the destructor, so we don't do any access checking or mark it referenced. We also don't emit -Wexit-time-destructors for these variables. rdar://21734598 Differential revision: https://reviews.llvm.org/D50994 llvm-svn: 340306
* [clang][NFC] Fix typo in the name of a noteLouis Dionne2018-08-211-1/+1
| | | | | | | | | | | | | | Summary: r306722 introduced a new note called note_silence_unligned_allocation_unavailable where I believe what was meant is note_silence_aligned_allocation_unavailable. Reviewers: ahatanak Subscribers: dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D51043 llvm-svn: 340288
* Removed unused variable [NFC]Mikael Holmen2018-08-211-1/+1
| | | | | | | | | | The compiler warned: ../tools/clang/lib/Sema/SemaType.cpp:6788:31: error: unused variable 'AT' [-Werror,-Wunused-variable] if (const AttributedType *AT = S.getCallingConvAttributedType(type)) { ^ 1 error generated. llvm-svn: 340251
* Model type attributes as regular Attrs.Richard Smith2018-08-206-284/+283
| | | | | | | | | | | | | | Specifically, AttributedType now tracks a regular attr::Kind rather than having its own parallel Kind enumeration, and AttributedTypeLoc now holds an Attr* instead of holding an ad-hoc collection of Attr fields. Differential Revision: https://reviews.llvm.org/D50526 This reinstates r339623, reverted in r339638, with a fix to not fail template instantiation if we instantiate a QualType with no associated type source information and we encounter an AttributedType. llvm-svn: 340215
* [ObjC] Error out when using forward-declared protocol in a @protocolAlex Lorenz2018-08-172-11/+5
| | | | | | | | | | | | | | | | | | | | | | expression Clang emits invalid protocol metadata when a @protocol expression is used with a forward-declared protocol. The protocol metadata is missing protocol conformance list of the protocol since we don't have access to the definition of it in the compiled translation unit. The linker then might end up picking the invalid metadata when linking which will lead to incorrect runtime protocol conformance checks. This commit makes sure that Clang fails to compile code that uses a @protocol expression with a forward-declared protocol. This ensures that Clang does not emit invalid protocol metadata. I added an extra assert in CodeGen to ensure that this kind of issue won't happen in other places. rdar://32787811 Differential Revision: https://reviews.llvm.org/D49462 llvm-svn: 340102
* Don't warn on returning the address of a label from a statement expressionReid Kleckner2018-08-171-0/+4
| | | | | | | | | | | | | | | | | Summary: There isn't anything inherently wrong with returning a label from a statement expression. In practice, the Linux kernel uses this pattern to materialize PCs. Fixes PR38569 Reviewers: niravd, rsmith, nickdesaulniers Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50805 llvm-svn: 340101
* [OPENMP] Fix processing of declare target construct.Alexey Bataev2018-08-141-24/+5
| | | | | | | The attribute marked as inheritable since OpenMP 5.0 supports it + additional fixes to support new functionality. llvm-svn: 339704
* We have in place support for parsing #pragma FENV_ACCESS, but that Kevin P. Neal2018-08-141-0/+12
| | | | | | | | | | | | | information is then discarded with a warning to the user that we don't support it. This patch gets us one step closer by getting the info down into the AST in most cases. Reviewed by: rsmith Differential Revision: https://reviews.llvm.org/D49865 llvm-svn: 339693
* Revert r339623 "Model type attributes as regular Attrs."Reid Kleckner2018-08-146-282/+284
| | | | | | | | This breaks compiling atlwin.h in Chromium. I'm sure the code is invalid in some way, but we put a lot of work into accepting it, and I'm sure rejecting it was not an intended consequence of this refactoring. :) llvm-svn: 339638
* Model type attributes as regular Attrs.Richard Smith2018-08-136-284/+282
| | | | | | | | | | Specifically, AttributedType now tracks a regular attr::Kind rather than having its own parallel Kind enumeration, and AttributedTypeLoc now holds an Attr* instead of holding an ad-hoc collection of Attr fields. Differential Revision: https://reviews.llvm.org/D50526 llvm-svn: 339623
* [OPENMP] Fix emission of the loop doacross constructs.Alexey Bataev2018-08-131-84/+185
| | | | | | | The number of loops associated with the OpenMP loop constructs should not be considered as the number loops to collapse. llvm-svn: 339603
* Enforce instantiation of template multiversion functionsErich Keane2018-08-131-4/+14
| | | | | | | | | Multiversioned member functions inside of a template type were not properly being emitted. The solution to this is to simply ensure that their bodies are correctly evaluated/assigned during template instantiation. llvm-svn: 339597
* [SEMA] add more -Wfloat-conversion to compound assigment analysisNick Desaulniers2018-08-131-27/+33
| | | | | | | | | | | | | | Summary: Fixes Bug: https://bugs.llvm.org/show_bug.cgi?id=27061 Reviewers: aaron.ballman, acoomans Reviewed By: aaron.ballman, acoomans Subscribers: acoomans, cfe-commits, srhines, pirama Differential Revision: https://reviews.llvm.org/D50467 llvm-svn: 339581
* Revert "[OPENMP] Fix emission of the loop doacross constructs."Alexey Bataev2018-08-131-179/+84
| | | | | | This reverts commit r339568 because of the problems with the buildbots. llvm-svn: 339574
* Summary:Add clang::reinitializes attributeMartin Bohme2018-08-131-0/+5
| | | | | | | | | | | | | | | | Summary: This is for use by clang-tidy's bugprone-use-after-move check -- see corresponding clang-tidy patch at https://reviews.llvm.org/D49910. Reviewers: aaron.ballman, rsmith Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49911 llvm-svn: 339569
* [OPENMP] Fix emission of the loop doacross constructs.Alexey Bataev2018-08-131-84/+179
| | | | | | | The number of loops associated with the OpenMP loop constructs should not be considered as the number loops to collapse. llvm-svn: 339568
* [CodeGen] Merge equivalent block copy/helper functions.Akira Hatanaka2018-08-101-1/+9
| | | | | | | | | | | | | | | | | | | | | | | Clang generates copy and dispose helper functions for each block literal on the stack. Often these functions are equivalent for different blocks. This commit makes changes to merge equivalent copy and dispose helper functions and reduce code size. To enable merging equivalent copy/dispose functions, the captured object infomation is encoded into the helper function name. This allows IRGen to check whether an equivalent helper function has already been emitted and reuse the function instead of generating a new helper function whenever a block is defined. In addition, the helper functions are marked as linkonce_odr to enable merging helper functions that have the same name across translation units and marked as unnamed_addr to enable the linker's deduplication pass to merge functions that have different names but the same content. rdar://problem/42640608 Differential Revision: https://reviews.llvm.org/D50152 llvm-svn: 339438
* Mark up deprecated methods as suchStephen Kelly2018-08-091-2/+8
| | | | | | | | | | Reviewers: teemperor! Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50352 llvm-svn: 339403
* Remove obsolete set callStephen Kelly2018-08-091-8/+0
| | | | | | | | | | | | | | Summary: Case case of the switch statement here makes the same call, but it is already done at the start of the function. Reviewers: rsmith, dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50409 llvm-svn: 339402
* Port getLocEnd -> getEndLocStephen Kelly2018-08-0922-298/+276
| | | | | | | | | | Reviewers: teemperor! Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50351 llvm-svn: 339386
* Port getLocStart -> getBeginLocStephen Kelly2018-08-0932-1875/+1698
| | | | | | | | | | Reviewers: teemperor! Subscribers: jholewinski, whisperity, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50350 llvm-svn: 339385
* Port getStartLoc -> getBeginLocStephen Kelly2018-08-092-2/+2
| | | | | | | | | | Reviewers: teemperor! Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50349 llvm-svn: 339384
* [NFC] Convert ParsedAttr to use llvm::TrailingObjectsErich Keane2018-08-092-5/+10
| | | | | | | | | | | ParsedAttr is using a hand-rolled trailing-objects implementation that gets cleaned up quite a bit by just using llvm::TrailingObjects. This is a large TrailingObjects list, but most things are length '0'. Differential Revision: https://reviews.llvm.org/D50531 llvm-svn: 339380
OpenPOWER on IntegriCloud