summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang] Fixing incorrect implicit deduction guides (PR41549)Gauthier Harnisch2019-06-141-0/+6
| | | | | | | | | | | | | | | | | | | | | Summary: [[ https://bugs.llvm.org/show_bug.cgi?id=41549 | bug report ]] Before this patch, implicit deduction guides were generated from the first declaration found by lookup. With this patch implicit deduction guides are generated from the definition of the class template. Also added test that was previously failing. Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits, Quuxplusone Tags: #clang Differential Revision: https://reviews.llvm.org/D63072 llvm-svn: 363361
* [clang] Don't segfault on incorrect using directive (PR41400)Gauthier Harnisch2019-06-141-1/+1
| | | | | | | | | | | | | | | | | | | Summary: this is a bugfixe for [[ https://bugs.llvm.org/show_bug.cgi?id=41400 | PR41400 ]] added nullptr check at the relevent place and test Reviewers: rsmith, riccibruno Reviewed By: rsmith Subscribers: jkooker, jkorous, riccibruno, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60523 llvm-svn: 363360
* Revert 363295, it caused PR42276. Also revert follow-ups 363337, 363340.Nico Weber2019-06-142-131/+51
| | | | | | | | Revert 363340 "Remove unused SK_LValueToRValue initialization step." Revert 363337 "PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type" Revert 363295 "C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue conversion applied to a member access or similar not-quite-trivial lvalue expression." llvm-svn: 363352
* Remove unused SK_LValueToRValue initialization step.Richard Smith2019-06-131-27/+0
| | | | | | | In addition to being unused and duplicating code, this was also wrong (it didn't properly mark the operand as being potentially not odr-used). llvm-svn: 363340
* PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of typeRichard Smith2019-06-132-5/+11
| | | | | | | | | | | | nullptr_t does not access memory. We now reuse CK_NullToPointer to represent a conversion from a glvalue of type nullptr_t to a prvalue of nullptr_t where necessary. This reinstates r345562, reverted in r346065, now that CodeGen's handling of non-odr-used variables has been fixed. llvm-svn: 363337
* C++ DR712 and others: handle non-odr-use resulting from an lvalue-to-rvalue ↵Richard Smith2019-06-131-26/+127
| | | | | | | | | | | | | | | | | | | | | conversion applied to a member access or similar not-quite-trivial lvalue expression. Summary: When a variable is named in a context where we can't directly emit a reference to it (because we don't know for sure that it's going to be defined, or it's from an enclosing function and not captured, or the reference might not "work" for some reason), we emit a copy of the variable as a global and use that for the known-to-be-read-only access. Reviewers: rjmccall Subscribers: jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63157 llvm-svn: 363295
* [OpenCL] Move OpenCLBuiltins.td and remove unused includeSven van Haastregt2019-06-133-1/+304
| | | | | | | | Patch by Pierre Gondois. Differential revision: https://reviews.llvm.org/D62849 llvm-svn: 363242
* PR42220: take into account the possibility of aggregates with baseRichard Smith2019-06-121-0/+3
| | | | | | classes when checking an InitListExpr for lifetime extension. llvm-svn: 363188
* Mark declarations as referenced by a default argument in aRichard Smith2019-06-111-0/+2
| | | | | | | | | potentially-evaluated context. This applies even if the use of the default argument is within an unevaluated context. llvm-svn: 363113
* For DR712: store on a MemberExpr whether it constitutes an odr-use.Richard Smith2019-06-112-29/+51
| | | | llvm-svn: 363087
* For DR712: store on a DeclRefExpr whether it constitutes an odr-use.Richard Smith2019-06-116-85/+305
| | | | | | | Begin restructuring to support the forms of non-odr-use reference permitted by DR712. llvm-svn: 363086
* Require stdcall etc parameters to be complete on ODR useReid Kleckner2019-06-101-0/+81
| | | | | | | | | | | | | | | | | | | Functions using stdcall, fastcall, or vectorcall with C linkage mangle in the size of the parameter pack. Calculating the size of the pack requires the parameter types to complete, which may require template instantiation. Previously, we would crash during IRgen when requesting the size of incomplete or uninstantiated types, as in this reduced example: struct Foo; void __fastcall bar(struct Foo o); void (__fastcall *fp)(struct Foo) = &bar; Reported in Chromium here: https://crbug.com/971245 Differential Revision: https://reviews.llvm.org/D62975 llvm-svn: 363000
* Re-land "[CodeComplete] Improve overload handling for C++ qualified and ↵Sam McCall2019-06-101-20/+121
| | | | | | | | ref-qualified methods." ShadowMapEntry is now really, truly a normal class. llvm-svn: 362950
* Revert "[CodeComplete] Improve overload handling for C++ qualified and ↵Sam McCall2019-06-101-112/+20
| | | | | | | | ref-qualified methods." This reverts commit r362924, which causes a double-free of ShadowMapEntry. llvm-svn: 362944
* Revert "Revert "[CodeComplete] Improve overload handling for C++ qualified ↵Sam McCall2019-06-101-20/+112
| | | | | | | | and ref-qualified methods."" This reverts commit r362830, and relands r362785 with the leak fixed. llvm-svn: 362924
* Revert "[CodeComplete] Improve overload handling for C++ qualified and ↵Vlad Tsyrklevich2019-06-071-111/+14
| | | | | | | | | | ref-qualified methods." This reverts commit f1f6e0fc2468e9c120b22b939507c527d08b8ee8, it was causing LSan failures on the sanitizer bots: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/32809 llvm-svn: 362830
* [CodeComplete] Improve overload handling for C++ qualified and ref-qualified ↵Sam McCall2019-06-071-14/+111
| | | | | | | | | | | | | | | | | | | | | methods. Summary: - when a method is not available because of the target value kind (e.g. an && method on a Foo& variable), then don't offer it. - when a method is effectively shadowed by another method from the same class with a) an identical argument list and b) superior qualifiers, then don't offer it. Reviewers: ilya-biryukov Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62582 llvm-svn: 362785
* Factor out duplicated code building a MemberExpr and marking itRichard Smith2019-06-063-44/+53
| | | | | | | | referenced. This reinstates r362563, reverted in r362597. llvm-svn: 362757
* Convert MemberExpr creation and serialization to work the same way asRichard Smith2019-06-061-3/+6
| | | | | | | | | | most / all other Expr subclasses. This reinstates r362551, reverted in r362597, with a fix to a bug that caused MemberExprs to sometimes have a null FoundDecl after a round-trip through an AST file. llvm-svn: 362756
* [OpenCL][PR42031] Prevent deducing addr space in type alias.Anastasia Stulova2019-06-051-0/+3
| | | | | | | | | Similar to typedefs we shouldn't deduce addr space in type alias. Differential Revision: https://reviews.llvm.org/D62591 llvm-svn: 362611
* Avoid using NoThrow Exception Specifier in non-C++ Modes.Erich Keane2019-06-051-13/+12
| | | | | | | | | | | | | | | | | As reported in https://bugs.llvm.org/show_bug.cgi?id=42113, there are a number of locations in Clang where it is assumed that exception specifications are only valid in C++ mode. Since the original justification for the NoThrow Exception Specifier Type was C++ related, this patch just makes C mode use the attribute-based nothrow handling. Additionally, I noticed that the handling of non-prototype functions regressed the behavior of the nothrow attribute, in part because it is was listed in the function type macro(which I did in the previous patch). In reality, it should only be doing so in a conditional nature, so this patch removes it there and puts it directly in the switch to be handled correctly. llvm-svn: 362607
* [Sema] Prevent binding incompatible addr space ref to temporariesAnastasia Stulova2019-06-051-1/+18
| | | | | | | | | | | | References to arbitrary address spaces can't always be bound to temporaries. This change extends the reference binding logic to check that the address space of a temporary can be implicitly converted to the address space in a reference when temporary materialization is performed. Differential Revision: https://reviews.llvm.org/D61318 llvm-svn: 362604
* Revert "Factor out duplicated code building a MemberExpr and marking it" and ↵Benjamin Kramer2019-06-053-53/+41
| | | | | | | | "Convert MemberExpr creation and serialization to work the same way as" This reverts commits r362551 and r362563. Crashes during modules selfhost. llvm-svn: 362597
* Factor out duplicated code building a MemberExpr and marking itRichard Smith2019-06-053-44/+53
| | | | | | referenced. llvm-svn: 362563
* Convert MemberExpr creation and serialization to work the same way asRichard Smith2019-06-041-3/+6
| | | | | | most / all other Expr subclasses. llvm-svn: 362551
* Factor out repeated code to build a DeclRefExpr and mark it referenced.Richard Smith2019-06-044-54/+35
| | | | llvm-svn: 362537
* PR42104: Support instantiations of lambdas that implicitly captureRichard Smith2019-06-045-56/+108
| | | | | | | | | | | | | | | | | packs. Two changes: * Track odr-use via FunctionParmPackExprs to properly handle dependent odr-uses of packs in generic lambdas. * Do not instantiate implicit captures; instead, regenerate them by instantiating the body of the lambda. This is necessary to distinguish between cases where only one element of a pack is captured and cases where the entire pack is captured. This reinstates r362358 (reverted in r362375) with a fix for an uninitialized variable use in UpdateMarkingForLValueToRValue. llvm-svn: 362531
* [CodeComplete] Include more text into typed chunks of pattern completionsIlya Biryukov2019-06-041-12/+4
| | | | | | | | | | | | | | | | | | | | | | | | Summary: To allow filtering on any of the words in the editors. In particular, the following completions were changed: - 'using namespace <#name#>' Typed text before: 'using', after: 'using namespace'. - 'else if (#<condition#>)' Before: 'else', after: 'else if'. - 'using typename <#qualifier#>::<#name#>' Before: 'using', after: 'using typename'. Reviewers: sammccall Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62615 llvm-svn: 362479
* Permit Exception Spec mismatch with NoThrow on inherited VirtualErich Keane2019-06-031-3/+15
| | | | | | | | | As reported here: https://bugs.llvm.org/show_bug.cgi?id=42100 This fairly common pattern ends up being an error in MinGW, so relax it in all cases to a warning. llvm-svn: 362434
* Re-check in clang support gun asm goto after fixing tests.Jennifer Yu2019-06-033-54/+124
| | | | llvm-svn: 362410
* [PR41567][Sema] Fixed cast kind in addr space conversionsAnastasia Stulova2019-06-031-0/+4
| | | | | | | | | This change sets missing cast kind correctly in the address space conversion case. Differential Revision: https://reviews.llvm.org/D62299 llvm-svn: 362409
* Revert rL362358 : PR42104: Support instantiations of lambdas that implicitly ↵Simon Pilgrim2019-06-035-108/+58
| | | | | | | | | | | | | | | | capture packs. Two changes: * Track odr-use via FunctionParmPackExprs to properly handle dependent odr-uses of packs in generic lambdas. * Do not instantiate implicit captures; instead, regenerate them by instantiating the body of the lambda. This is necessary to distinguish between cases where only one element of a pack is captured and cases where the entire pack is captured. ........ Fixes http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win buildbot failures llvm-svn: 362375
* [OpenCL] Declare builtin functions using TableGenSven van Haastregt2019-06-031-0/+84
| | | | | | | | | | | | | | | | | | | | | | | This patch adds a `-fdeclare-opencl-builtins` command line option to the clang frontend. This enables clang to verify OpenCL C builtin function declarations using a fast StringMatcher lookup, instead of including the opencl-c.h file with the `-finclude-default-header` option. This avoids the large parse time penalty of the header file. This commit only adds the basic infrastructure and some of the OpenCL builtins. It does not cover all builtins defined by the various OpenCL specifications. As such, it is not a replacement for `-finclude-default-header` yet. RFC: http://lists.llvm.org/pipermail/cfe-dev/2018-November/060041.html Co-authored-by: Pierre Gondois Co-authored-by: Joey Gouly Co-authored-by: Sven van Haastregt Differential Revision: https://reviews.llvm.org/D60763 llvm-svn: 362371
* [CodeComplete] Add a bit more whitespace to completed patternsIlya Biryukov2019-06-031-0/+17
| | | | | | | | | | | | | | | | | | | | Summary: E.g. we now turn `while(<#cond#>){` into `while (<#cond#>) {` This slightly improves the final output. Should not affect clients that format the result on their own. Reviewers: gribozavr Reviewed By: gribozavr Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62616 llvm-svn: 362363
* PR42104: Support instantiations of lambdas that implicitly captureRichard Smith2019-06-035-58/+108
| | | | | | | | | | | | | | packs. Two changes: * Track odr-use via FunctionParmPackExprs to properly handle dependent odr-uses of packs in generic lambdas. * Do not instantiate implicit captures; instead, regenerate them by instantiating the body of the lambda. This is necessary to distinguish between cases where only one element of a pack is captured and cases where the entire pack is captured. llvm-svn: 362358
* [coroutines][PR41909] Don't build dependent coroutine statements for generic ↵Brian Gesiak2019-06-031-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lambda Summary: https://bugs.llvm.org/show_bug.cgi?id=41909 describes an issue in which a generic lambda that takes a dependent argument `auto set` causes the template instantiation machinery for coroutine body statements to crash with an ICE. The issue is two-fold: 1. The paths taken by the template instantiator contain several asserts that the coroutine promise must not have a dependent type. 2. The template instantiator unconditionally builds corotuine statements that depend on the promise type, which cannot be dependent. To work around the issue, prevent the template instantiator from building dependent coroutine statements if the coroutine promise type is dependent. Since we only expect this to occur in the case of a generic lambda, limit the workaround behavior to just that case. Reviewers: GorNishanov, EricWF, lewissbaker, tks2103 Reviewed By: GorNishanov Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62550 llvm-svn: 362348
* Transform lambda expression captures when transforming an expression toRichard Smith2019-06-023-28/+44
| | | | | | | | | potentially-evaluated. This ensures that every potentially-evaluated expression is built in a potentially-evaluated context. No functionality change intended. llvm-svn: 362336
* Factor out commonality between variable capture initialization andRichard Smith2019-06-022-92/+101
| | | | | | 'this' capture initialization. llvm-svn: 362317
* Replace 'default' in an enum-over-a-switch with the missing list.Erich Keane2019-05-311-1/+5
| | | | | | | This suppressed the Wswitch warning causing me to miss it and write an assertion failure. llvm-svn: 362245
* Suppress nothrow/Exception spec conflict warning when we dont know the ES.Erich Keane2019-05-311-7/+7
| | | | | | | In any situation where the Exception Spec isn't clear, suppress the warning to avoid false positives. llvm-svn: 362243
* Suppress nothrow/exception spec conflict warning when ES is parsed.Erich Keane2019-05-311-1/+3
| | | | | | | | | | | | | | The previously added warning ended up causing false positives when nothrow was used on member functions, where the exception specification wasn't yet parsed. So, throw() and noexcept(true) both were incorrectly warning. There doesn't seem to be a good way to force these to be parsed to identify which they are (and likely should not be), so suppress the warning. For now, unevaluated/uninstantiated are left as warnings as I am not creative enough to find a reproducer that causes a false positive for either. llvm-svn: 362236
* Fix for PR42089, regression from r362119Erich Keane2019-05-311-1/+8
| | | | | | | | | The implementation of the NoThrow ExceptionSpecificationType missed a switch statement for forming the diagnostic when an out-of-line member redeclaration misses the exception specification. This patch adds the correct case statement. llvm-svn: 362225
* PR39728: When completing a class, complete the destructor first.Richard Smith2019-05-311-39/+53
| | | | | | | | | We need to know whether the destructor is trivial in order to tell whether other parts of the class are valid (in particular, this affects whether the type is a literal type, which affects whether defaulted special members can be declared constexpr or are implicitly constexpr). llvm-svn: 362184
* Defer building 'this' captures until we have left the capturing regionRichard Smith2019-05-314-41/+25
| | | | | | | | | | and returned to the context in which 'this' should be captured. This means we now always mark 'this' referenced from the context in which it's actually referenced, rather than potentially from some context nested within that. llvm-svn: 362182
* Defer capture initialization for captured regions until after we've leftRichard Smith2019-05-316-64/+132
| | | | | | | | | | | | | | | | the captured region scope. This removes a case where we would build expressions (and mark declarations odr-used) in the wrong scope. Remove the now-unused 'capture initializer' field on sema::Capture (except for 'this' captures, which still need to be cleaned up). No functionality change intended (except that we now very slightly more precisely determine whether we need to use a capture or not when another captured region encloses an OpenMP captured region). llvm-svn: 362179
* Defer capture initialization for blocks until after we've left theRichard Smith2019-05-313-80/+106
| | | | | | | | | function scope. This removes one of the last few cases where we build expressions in the wrong function scope context. No functionality change intended. llvm-svn: 362178
* Refactor OpenMP stack management.Richard Smith2019-05-301-214/+224
| | | | | | | | | | Instead of duplicating access to the directive stack throughout SemaOpenMP.cpp, consolidate it to a few methods and call those everywhere else. In passing, simplify adjacent code where possible. No functionality change intended. llvm-svn: 362172
* Fix "fallthrough annotation in unreachable code" warning.Richard Smith2019-05-301-1/+1
| | | | llvm-svn: 362171
* Add Attribute NoThrow as an Exception Specifier TypeErich Keane2019-05-304-2/+64
| | | | | | | | | | | | | | | In response to https://bugs.llvm.org/show_bug.cgi?id=33235, it became clear that the current mechanism of hacking through checks for the exception specification of a function gets confused really quickly when there are alternate exception specifiers. This patch introcues EST_NoThrow, which is the equivilent of EST_noexcept when caused by EST_noThrow. The existing implementation is left in place to cover functions with no FunctionProtoType. Differential Revision: https://reviews.llvm.org/D62435 llvm-svn: 362119
* Revert "clang support gnu asm goto."Erich Keane2019-05-303-124/+54
| | | | | | | | | | | This reverts commit 954ec09aed4f2be04bb5f4e10dbb4ea8bd19ef9a. Reverting due to test failures as requested by Jennifer Yu. Conflicts: clang/test/CodeGen/asm-goto.c llvm-svn: 362106
OpenPOWER on IntegriCloud