summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Mass-rename the handful of error_* diagnostics to err_*.Richard Smith2016-12-028-45/+45
| | | | llvm-svn: 288545
* [Sema] Reset a BumpPtrAllocator on clear(). NFC.George Burgess IV2016-12-021-0/+1
| | | | | | Looks like the reset() call was omitted by accident. llvm-svn: 288534
* PR31081: ignore exception specifications when deducing function templateRichard Smith2016-12-014-43/+89
| | | | | | | arguments from a declaration; despite what the standard says, this form of deduction should not be considering exception specifications. llvm-svn: 288301
* [OpenMP] Sema and parsing for 'teams distribute parallel for simd' pragmaKelvin Li2016-11-302-5/+75
| | | | | | | | This patch is to implement sema and parsing for 'teams distribute parallel for simd' pragma. Differential Revision: https://reviews.llvm.org/D27084 llvm-svn: 288294
* [Sema] Teach -Wcast-align to look at the aligned attribute of theAkira Hatanaka2016-11-301-0/+22
| | | | | | | | | | | | | declared variables. Teach Sema to check the aligned attribute attached to variable declarations so that it doesn't issue spurious warnings. rdar://problem/26517471 Differential revision: https://reviews.llvm.org/D21099 llvm-svn: 288267
* Fix formatting issue from r288207Hans Wennborg2016-11-301-1/+1
| | | | llvm-svn: 288223
* [c++1z] Improve support for -fno-exceptions: we can't just ignore exceptionRichard Smith2016-11-302-41/+55
| | | | | | | | | specifications in this mode in C++17, since they're part of the function type, so check and diagnose them like we would if exceptions were enabled. Better ideas welcome. llvm-svn: 288220
* [c++1z] PR31210: ignore exception specification when matching the type of aRichard Smith2016-11-291-3/+19
| | | | | | builtin with the type of an explicit declaration of the same function. llvm-svn: 288208
* Don't try to merge DLL attributes on redeclaration of invalid decl (PR31069)Hans Wennborg2016-11-291-0/+3
| | | | llvm-svn: 288207
* [OpenCL] Prohibit using reserve_id_t in program scope.Alexey Bader2016-11-291-50/+55
| | | | | | | | | | | | Patch by Egor Churaev (echuraev). Reviewers: Anastasia Subscribers: cfe-commits, yaxunl, bader Differential Revision: https://reviews.llvm.org/D27099 llvm-svn: 288126
* Add a warning for 'main' returning 'true' or 'false'.Richard Smith2016-11-291-0/+4
| | | | | | Patch by Joshua Hurwitz! llvm-svn: 288097
* Use ${:uid} to generate unique MS asm labels, not {:uid}Reid Kleckner2016-11-291-1/+1
| | | | llvm-svn: 288093
* [MS] Mangle a unique ID into all MS inline asm labelsReid Kleckner2016-11-282-8/+5
| | | | | | | | | | | | This solves PR23715 in a way that is compatible with LTO. MSVC supports jumping to source-level labels and between inline asm blocks, but we don't. Also revert the old solution, r255201, which was to mark these calls as noduplicate. llvm-svn: 288059
* [OPENMP] Fix for PR31137: Wrong DSA for members in struct.Alexey Bataev2016-11-281-1/+2
| | | | | | | | | If member expression is used in the task region and the base expression is a DeclRefExp and the variable used in this ref expression is private, it should be marked as implicitly firstprivate inside this region. Patch fixes this issue. llvm-svn: 288039
* [Sema] Set range end of constructors and destructors in template instantiationsMalcolm Parsons2016-11-281-0/+2
| | | | | | | | | | | | | | | | | | Summary: clang-tidy checks frequently use source ranges of functions. The source range of constructors and destructors in template instantiations is currently a single token. The factory method for constructors and destructors does not allow the end source location to be specified. Set end location manually after creating instantiation. Reviewers: aaron.ballman, rsmith, arphaman Subscribers: arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D26849 llvm-svn: 288025
* Adjust type-trait evaluation to properly handle Using(Shadow)DeclsHal Finkel2016-11-271-4/+10
| | | | | | | | | | | | | | | | Since r274049, for an inheriting constructor declaration, the name of the using declaration (and using shadow declaration comes from the using declaration) is the name of a derived class, not the base class (line 8225-8232 of lib/Sema/SemaDeclCXX.cpp in https://reviews.llvm.org/rL274049). Because of this, name-based lookup performed inside Sema::LookupConstructors returns not only CXXConstructorDecls but also Using(Shadow)Decls, which results assertion failure reported in PR29087. Patch by Taewook Oh, thanks! Differential Revision: https://reviews.llvm.org/D23765 llvm-svn: 287999
* [Sema] Pass APSInts by const ref, avoiding copies.Benjamin Kramer2016-11-241-3/+3
| | | | | | | No functionality change intended. Fix by clang-tidy's performance-unnecessary-value-param check. llvm-svn: 287890
* Remove comments (NFC)Kelvin Li2016-11-241-1509/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D27006 llvm-svn: 287852
* [Sema][Atomics] Treat expected pointer in compare exchange atomics as _NonnullAlex Lorenz2016-11-231-0/+3
| | | | | | | | | | | This commit teaches clang that is has to emit a warning when NULL is passed as the 'expected' pointer parameter into an atomic compare exchange call. rdar://18926650 Differential Revision: https://reviews.llvm.org/D26978 llvm-svn: 287776
* Remove C++ default arg side table for MS ABI ctor closuresReid Kleckner2016-11-233-28/+23
| | | | | | | | | | | | | | | | | | | Summary: We don't need a side table in ASTContext to hold CXXDefaultArgExprs. The important part of building the CXXDefaultArgExprs was to ODR use the default argument expressions, not to make AST nodes. Refactor the code to only check the default argument, and remove the side table in ASTContext which wasn't being serialized. Fixes PR31121 Reviewers: thakis, rsmith, majnemer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D27007 llvm-svn: 287774
* [CodeCompletion] Fix incorrect Objective-C block parameter formattingAlex Lorenz2016-11-231-4/+8
| | | | | | | | | | This commit fixes an incorrectly formatted Objective-C block parameter placeholder in a code completion result. The incorrect parameter had a redundant leading parenthesis. rdar://25224416 llvm-svn: 287771
* [X86] Replace valignd/q builtins with appropriate __builtin_shufflevector.Craig Topper2016-11-231-6/+0
| | | | llvm-svn: 287733
* Make diagnostic for use of default member initializer before enclosing class isRichard Smith2016-11-222-16/+7
| | | | | | | complete a little more general; it is produced in other cases than the one that it previously talked about. llvm-svn: 287713
* Sema, CodeGen: Ensure that an implicit copy ctor is available more often ↵Peter Collingbourne2016-11-221-0/+11
| | | | | | | | | | | | | | | | under the Microsoft C++ ABI. This is needed because whether the constructor is deleted can control whether we pass structs by value directly. To fix this properly we probably want a more direct way for CodeGen to ask whether the constructor was deleted. Fixes PR31049. Differential Revision: https://reviews.llvm.org/D26822 llvm-svn: 287600
* Sema: As of MSVC 2015, a user-declared move operation causes the deletion of ↵Peter Collingbourne2016-11-191-4/+9
| | | | | | | | both copy operations. Differential Revision: https://reviews.llvm.org/D26868 llvm-svn: 287411
* [Sema] Don't allow applying address-of operator to a call to a functionAkira Hatanaka2016-11-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | with __unknown_anytype return type. When the following code is compiled, Sema infers that the type of __unknown_anytype is double: extern __unknown_anytype func(); double *d = (double*)&func(); This triggers an assert in CodeGenFunction::EmitCallExprLValue because it doesn't expect to see a call to a function with a non-reference scalar return type. This commit prevents the assert by making VisitUnaryAddrOf error out if the address-of operator is applied to a call to a function with __unknown_anytype return type. rdar://problem/20287610 Differential revision: https://reviews.llvm.org/D26808 llvm-svn: 287410
* [ARM] Fix sema check of ARM special register namesOleg Ranevskyy2016-11-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This is a simple sema check patch for arguments of `__builtin_arm_rsr` and the related builtins, which currently do not allow special registers with indexes >7. Some of the possible register name formats these builtins accept are: ``` {c}p<coprocessor>:<op1>:c<CRn>:c<CRm>:<op2> ``` ``` o0:op1:CRn:CRm:op2 ``` where `op1` / `op2` are integers in the range [0, 7] and `CRn` / `CRm` are integers in the range [0, 15]. The current sema check does not allow `CRn` > 7 and accepts `op2` up to 15. Reviewers: LukeCheeseman, rengolin Subscribers: asl, aemerson, rengolin, cfe-commits Differential Revision: https://reviews.llvm.org/D26464 llvm-svn: 287378
* [OpenCL] Introduce ReadPipeType and WritePipeType.Joey Gouly2016-11-182-10/+31
| | | | | | | This allows Sema to diagnose passing a read_only pipe to a write_only pipe argument. llvm-svn: 287343
* Fixes for r287241. Use placement new. Apply clang-format.Malcolm Parsons2016-11-172-7/+4
| | | | llvm-svn: 287258
* Use unique_ptr for cached tokens for default arguments in C++.Malcolm Parsons2016-11-172-5/+9
| | | | | | | | | | | | | | | | | Summary: This changes pointers to cached tokens for default arguments in C++ from raw pointers to unique_ptrs. There was a fixme in the code where the cached tokens are created about using a smart pointer. The change is straightforward, though I did have to track down and fix a memory corruption caused by the change. memcpy was being used to copy parameter information. This duplicated the unique_ptr, which led to the cached token buffer being deleted prematurely. Patch by David Tarditi! Reviewers: malcolm.parsons Subscribers: arphaman, malcolm.parsons, cfe-commits Differential Revision: https://reviews.llvm.org/D26435 llvm-svn: 287241
* Sema: correct typo correction for ivars in @implementationSaleem Abdulrasool2016-11-171-3/+10
| | | | | | | | | | | | The previous typo correction handling assumed that ivars are only declared in the interface declaration rather than as a private ivar in the implementation. Adjust the handling to permit both interfaces. Assert earlier that the interface has been acquired to ensure that we can identify when both possible casts have failed. Addresses PR31040! llvm-svn: 287238
* [Sema] Fix a bug in enable_if condition instantiation.George Burgess IV2016-11-171-3/+2
| | | | | | | | | | | During template instantiation, we currently fall back to just calling Sema::SubstExpr for enable_if attributes that aren't value-dependent or type-dependent. Since Sema::SubstExpr strips off any implicit casts we've added to an expression, it's possible that this behavior will leave us with an enable_if condition that's just a DeclRefExpr. Conditions like that deeply confuse Sema::CheckEnableIf. llvm-svn: 287187
* Add warning when assigning enums to bitfields without an explicit unsigned ↵Reid Kleckner2016-11-161-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | underlying type Summary: Add a warning when assigning enums to bitfields without an explicit unsigned underlying type. This is to prevent problems with MSVC compatibility, since the Microsoft ABI defaults to storing enums with a signed type, causing inconsistencies with saving to/reading from bitfields. Also disabled the warning in the dr0xx.cpp test which throws the error, and added a test for the warning. The warning can be disabled with -Wno-signed-enum-bitfield. Patch by Sasha Bermeister! Reviewers: rnk, aaron.ballman Subscribers: mehdi_amini, aaron.ballman, cfe-commits, thakis, dcheng Differential Revision: https://reviews.llvm.org/D24289 llvm-svn: 287177
* Use the member function location in enable_if diagnostics.George Burgess IV2016-11-161-2/+2
| | | | | | | | | | | | | | Before: <stdin>:3:3: error: no matching member function for call to 'bar' Foo().bar(); ^ After: <stdin>:3:9: error: no matching member function for call to 'bar' Foo().bar(); ^ llvm-svn: 287154
* [Frontend] Allow attaching an external sema source to compiler instance and ↵Benjamin Kramer2016-11-161-0/+4
| | | | | | | | | | | extra diags to TypoCorrections This can be used to append alternative typo corrections to an existing diag. include-fixer can use it to suggest includes to be added. Differential Revision: https://reviews.llvm.org/D26745 llvm-svn: 287128
* Rangify for loop, NFC.Yaron Keren2016-11-161-6/+4
| | | | llvm-svn: 287102
* [OpenCL] Use the semantic spelling of the Access attribute, rather than a ↵Joey Gouly2016-11-161-12/+15
| | | | | | | | | string. Also fix a latent bug, due to an incorrect traversal of the AttributeList. llvm-svn: 287100
* Fixed spelling in comments. NFCI.Simon Pilgrim2016-11-151-1/+1
| | | | llvm-svn: 286996
* [OPENMP] Fix for PR30632: Name mangling issue.Alexey Bataev2016-11-151-3/+4
| | | | | | | | Reworked fix after comments from Richard Smith. We must skip all CapturedDecl-based contexts when trying to get correct mangling number context. llvm-svn: 286953
* [OpenCL] Fix for integer parameters of enqueue_kernelAnastasia Stulova2016-11-141-19/+23
| | | | | | | | | | | | | | Make handling integer parameters more flexible: - For the number of events argument allow to pass larger integers than 32 bits as soon as compiler can prove that the range fits in 32 bits. If not, the diagnostic will be given. - Change type of the arguments specifying the sizes of the corresponding block arguments to be size_t. Review: https://reviews.llvm.org/D26509 llvm-svn: 286849
* [OpenCL] Change to clk_event parameter in enqueue_kernel.Anastasia Stulova2016-11-141-4/+8
| | | | | | | | | - Accept NULL pointer as a valid parameter value for clk_event. - Generate clk_event_t arguments of internal __enqueue_kernel_XXX function as pointers in generic address space. Review: https://reviews.llvm.org/D26507 llvm-svn: 286836
* Revert "Improve handling of floating point literals in OpenCL to only use ↵Renato Golin2016-11-142-23/+9
| | | | | | | | double precision if the target supports fp64." This reverts commit r286815, as it broke all ARM and AArch64 bots. llvm-svn: 286818
* Improve handling of floating point literals in OpenCL to only use double ↵Neil Hickey2016-11-142-9/+23
| | | | | | | | | | | | | | precision if the target supports fp64. This change makes sure single-precision floating point types are used if the cl_fp64 extension is not supported by the target. Also removed the check to see whether the OpenCL version is >= 1.2, as this has been incorporated into the extension setting code. Differential Revision: https://reviews.llvm.org/D24235 llvm-svn: 286815
* Remove some false positives when taking the address of packed membersRoger Ferrer Ibanez2016-11-141-15/+93
| | | | | | Differential Revision: https://reviews.llvm.org/D23657 llvm-svn: 286798
* Fix PR28366: Handle variables from enclosing local scopes more gracefully ↵Faisal Vali2016-11-131-1/+1
| | | | | | | | | | | | | | | | | | during constant expression evaluation. Only look for a variable's value in the constant expression evaluation activation frame, if the variable was indeed declared in that frame, otherwise it might be a constant expression and be usable within a nested local scope or emit an error. void f(char c) { struct X { static constexpr char f() { return c; // error gracefully here as opposed to crashing. } }; int I = X::f(); } llvm-svn: 286748
* Use descriptive message if list initializer is incorrectly parenthesized.Serge Pavlov2016-11-122-1/+48
| | | | | | | | | | | | | If initializer contains parentheses around braced list where it is not allowed, as in construct int({0}), clang issued message like `functional-style cast from 'void' to 'int' is not allowed`, which does not help much. Both gcc and msvc issue message `list-initializer for non-class type must not be parenthesized`, which is more descriptive. This change implements similar message for clang. Differential Revision: https://reviews.llvm.org/D25816 llvm-svn: 286721
* [AVX-512] Convert the rest of the masked shift by immediate and by single ↵Craig Topper2016-11-121-11/+0
| | | | | | | | element builtins over to the newly added unmasked builtins and a select. This should also fix PR30691 since the new builtins are handled like the legacy builtins in the backend. llvm-svn: 286714
* Remove double setting of invalid flag.Richard Trieu2016-11-111-2/+0
| | | | | | | | In r286630, Decl::setInvalidDecl will automatically set the invalid flag for BindingDecl for children in invalid DecompositionDecl. It no longer is necessary to do a separate setInvalidDecl when finalizing a BindingDecl. llvm-svn: 286641
* Fix for PR28523: unexpected compilation error.Alexey Bataev2016-11-114-10/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang emits error message for the following code: ``` template <class F> void parallel_loop(F &&f) { f(0); } int main() { int x; parallel_loop([&](auto y) { { x = y; }; }); } ``` $ clang++ --std=gnu++14 clang_test.cc -o clang_test clang_test.cc:9:7: error: reference to local variable 'x' declared in enclosing function 'main' x = y; ^ clang_test.cc:2:48: note: in instantiation of function template specialization 'main()::(anonymous class)::operator()<int>' requested here template <class F> void parallel_loop(F &&f) { f(0); } ^ clang_test.cc:6:3: note: in instantiation of function template specialization 'parallel_loop<(lambda at clang_test.cc:6:17)>' requested here parallel_loop([&](auto y) { ^ clang_test.cc:5:7: note: 'x' declared here int x; ^ 1 error generated. Patch fixes this issue. llvm-svn: 286584
* Don't require nullability on 'va_list', even when it's a pointer.Jordan Rose2016-11-111-28/+35
| | | | | | | | Take 3! This should finally fix the Hexagon, PPC, and Windows bots. rdar://problem/25846421 llvm-svn: 286542
OpenPOWER on IntegriCloud