summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Add #pragma clang attribute support to the availability attributeAlex Lorenz2017-04-201-3/+1
| | | | | | rdar://31707804 llvm-svn: 300826
* PR32673: Don't wrap parameter packs in SubstTemplateTypeParmPackType nodes ↵Richard Smith2017-04-201-5/+16
| | | | | | | | | when forming implicit deduction guides. Doing so thwarts template type deduction. Instead, substitute the pack directly by picking "slice 0" of the resulting expansion. llvm-svn: 300805
* [Sema] Use MSVC inner class behavior on ItaniumShoaib Meenai2017-04-201-3/+4
| | | | | | | | | | | | | | Windows Itanium aims to use MSVC export and import semantics. Inner class members shouldn't be exported on a dllexport explicit instantiation definition of the outer class, and they shouldn't be imported on a dllimport explicit instantiation declaration of the outer class (instead a local copy should be emitted). We were doing the first but not the second, and this mismatch can lead to link errors. Fix the behavior and add tests for both. Differential Revision: https://reviews.llvm.org/D32213 llvm-svn: 300804
* [OpenMP] Prepare sema to support combined constructs with omp distribute and ↵Carlo Bertolli2017-04-201-8/+80
| | | | | | | | | | omp for https://reviews.llvm.org/D32237 This patch prepares sema with additional fields to support all those composite and combined constructs of OpenMP that include pragma 'distribute' and 'for', such as 'distribute parallel for'. It also extends the regression tests for 'distribute parallel for' and adds a new one. llvm-svn: 300802
* [Sema][ObjC] Disallow jumping into ObjC fast enumeration loops.Akira Hatanaka2017-04-192-0/+10
| | | | | | | | rdar://problem/31635406 Differential Revision: https://reviews.llvm.org/D32187 llvm-svn: 300722
* Add #pragma clang attribute support to the external_source_symbol attributeAlex Lorenz2017-04-191-14/+7
| | | | | | | | | | | | | | | | | | | Prior to this commit the external_source_symbol attribute wasn't supported by #pragma clang attribute for the following two reasons: - The Named attribute subject hasn't been supported by TableGen. - There was no way to specify a subject match rule for #pragma clang attribute that could operate on a set of attribute subjects (e.g. the ones that derive from NamedDecl). This commit fixes the two issues and thus adds external_source_symbol support to #pragma clang attribute. rdar://31169028 Differential Revision: https://reviews.llvm.org/D32176 llvm-svn: 300712
* Add support for editor placeholders to ClangAlex Lorenz2017-04-193-0/+11
| | | | | | | | | | | | | | | | | | | | | This commit teaches Clang to recognize editor placeholders that are produced when an IDE like Xcode inserts a code-completion result that includes a placeholder. Now when the lexer sees a placeholder token, it emits an 'editor placeholder in source file' error and creates an identifier token that represents the placeholder. The parser/sema can now recognize the placeholders and can suppress the diagnostics related to the placeholders. This ensures that live issues in an IDE like Xcode won't get spurious diagnostics related to placeholders. This commit also adds a new compiler option named '-fallow-editor-placeholders' that silences the 'editor placeholder in source file' error. This is useful for an IDE like Xcode as we don't want to display those errors in live issues. rdar://31581400 Differential Revision: https://reviews.llvm.org/D32081 llvm-svn: 300667
* Revert r300653 and r300650. The underlying commit fixes one issue withChandler Carruth2017-04-191-5/+17
| | | | | | | | | | modules but exposes much more widespread issues. Example and more information is on the review thread for r300650. Original commit summary: [modules] Properly look up the owning module for an instantiation of a merged template. llvm-svn: 300659
* [modules] Properly look up the owning module for an instantiation of a ↵Richard Smith2017-04-191-17/+5
| | | | | | | | | | | | merged template. When looking for the template instantiation pattern of a templated entity, consistently select the definition of the pattern if there is one. This means we'll pick the same owning module when we start instantiating a template that we'll later pick when determining which modules are visible during that instantiation. llvm-svn: 300650
* The SubjectMatchRule enum should not be used as a DenseMap key to avoidAlex Lorenz2017-04-181-12/+14
| | | | | | | | | | | UBSAN 'invalid value' failures The commit r300556 introduced a UBSAN issue that was caught by http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap. The DenseMap failed to create an empty/tombstone value as the empty/tombstone values for the SubjectMatchRule enum were not valid enum constants. llvm-svn: 300591
* Remove unused varibleReid Kleckner2017-04-181-4/+0
| | | | | | | | | | | | | | | | | The Result variable is unused both in Sema::CheckARMBuiltinFunctionCall and Sema::CheckAArch64BuiltinFunctionCall, remove it. Patch by Wei-Ren Chen! Reviewers: craig.topper, rnk Reviewed By: rnk Subscribers: aemerson, cfe-commits, rengolin Differential Revision: https://reviews.llvm.org/D32014 llvm-svn: 300572
* Add #pragma clang attributeAlex Lorenz2017-04-187-39/+280
| | | | | | | | | | | | | | | | | This is a recommit of r300539 that was reverted in r300543 due to test failures. The original commit message is displayed below: The new '#pragma clang attribute' directive can be used to apply attributes to multiple declarations. An attribute must satisfy the following conditions to be supported by the pragma: - It must have a subject list that's defined in the TableGen file. - It must be documented. - It must not be late parsed. - It must have a GNU/C++11 spelling. Differential Revision: https://reviews.llvm.org/D30009 llvm-svn: 300556
* Revert r300539 - Add #pragma clang attributeAlex Lorenz2017-04-187-280/+39
| | | | | | | Some tests fail on the Windows buildbots. I will have to investigate more. This commit reverts r300539, r300540 and r300542. llvm-svn: 300543
* Add #pragma clang attributeAlex Lorenz2017-04-187-39/+280
| | | | | | | | | | | | | | The new '#pragma clang attribute' directive can be used to apply attributes to multiple declarations. An attribute must satisfy the following conditions to be supported by the pragma: - It must have a subject list that's defined in the TableGen file. - It must be documented. - It must not be late parsed. - It must have a GNU/C++11 spelling. Differential Revision: https://reviews.llvm.org/D30009 llvm-svn: 300539
* Assert that a valid operator new/delete signature is always found by the ↵Eric Fiselier2017-04-181-4/+3
| | | | | | coroutine body llvm-svn: 300529
* Speculatively attempt to fix bot failures caused by recent coroutine changes.Eric Fiselier2017-04-181-3/+6
| | | | llvm-svn: 300528
* [coroutines] Fix building of new/delete expressions when ↵Eric Fiselier2017-04-181-8/+75
| | | | | | | | | | | | | | | | | | | | | | get_return_object_on_allocation_failure() is present. Summary: This patch implements [dcl.fct.def.coroutine]p8: > The unqualified-id get_return_object_on_allocation_failure is looked up in the scope of > class P by class member access lookup (3.4.5). If a declaration is found, ..., and if a > global allocation function is selected, the ::operator new(size_t, nothrow_t) form shall be used. > [...] > The allocation function used in this case must have a non-throwing noexcept-specification. Reviewers: GorNishanov, rsmith, majnemer, aaron.ballman Reviewed By: GorNishanov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31562 llvm-svn: 300524
* Revert r300504 - [coroutines] Fix rebuilding of implicit and dependent ↵Eric Fiselier2017-04-171-75/+8
| | | | | | | | | coroutine statements. I have no idea what's happening here. The tests that fail on all of the bots pass on my machine. Further investigation needed. llvm-svn: 300511
* [coroutines] Fix rebuilding of implicit and dependent coroutine statements.Eric Fiselier2017-04-171-8/+75
| | | | | | | | | | | | | | | | | | | Summary: Certain implicitly generated coroutine statements, such as the calls to 'return_value()' or `return_void()` or `get_return_object_on_allocation_failure()`, cannot be built until the promise type is no longer dependent. This means they are not built until after the coroutine body statement has been transformed. This patch fixes an issue where these statements would never be built for coroutine templates. It also fixes a small issue where diagnostics about `get_return_object_on_allocation_failure()` were incorrectly suppressed. Reviewers: rsmith, majnemer, GorNishanov, aaron.ballman Reviewed By: GorNishanov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31487 llvm-svn: 300504
* Revert r300420 - [coroutines] Fix building of new/delete expressions when ↵Eric Fiselier2017-04-161-75/+8
| | | | | | get_return_object_on_allocation_failure() is present llvm-svn: 300421
* [coroutines] Fix building of new/delete expressions when ↵Eric Fiselier2017-04-161-8/+75
| | | | | | | | | | | | | | | | | | | | | | get_return_object_on_allocation_failure() is present. Summary: This patch implements [dcl.fct.def.coroutine]p8: > The unqualified-id get_return_object_on_allocation_failure is looked up in the scope of > class P by class member access lookup (3.4.5). If a declaration is found, ..., and if a > global allocation function is selected, the ::operator new(size_t, nothrow_t) form shall be used. > [...] > The allocation function used in this case must have a non-throwing noexcept-specification. Reviewers: GorNishanov, rsmith, majnemer, aaron.ballman Reviewed By: GorNishanov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31562 llvm-svn: 300420
* [ObjC] Use empty Objective-C collection literal constants whenAkira Hatanaka2017-04-151-0/+12
| | | | | | | | | | | | | available. Original patch by Douglas Gregor with minor modifications. This recommits r300389, which broke bots because there have been API changes since the original patch was written. rdar://problem/20689633 llvm-svn: 300396
* Revert "[ObjC] Use empty Objective-C collection literal constants when"Akira Hatanaka2017-04-151-12/+0
| | | | | | | This reverts commit r300389. There were mistakes in the changes I made to CodeGen. llvm-svn: 300391
* [ObjC] Use empty Objective-C collection literal constants whenAkira Hatanaka2017-04-151-0/+12
| | | | | | | | | | available. Original patch by Douglas Gregor with minor modifications. rdar://problem/20689633 llvm-svn: 300389
* PR32280: Do not crash on nested initializers.Vassil Vassilev2017-04-141-8/+10
| | | | | | Patch by Yuka Takahashi (D31591)! llvm-svn: 300313
* Fix PR31934: forming refs to functions with enable_if attrs.George Burgess IV2017-04-131-0/+13
| | | | llvm-svn: 300283
* Diagnose attempt to take address of bitfield members in anonymous structs.Richard Smith2017-04-131-1/+4
| | | | | | | | Patch by Jacob Young! Differential Revision: https://reviews.llvm.org/D27263 llvm-svn: 300264
* PR32185: Revert r291512 and add a testcase for PR32185.Richard Smith2017-04-131-19/+19
| | | | | | | | | | | | | | | This reverts an attempt to check that types match when matching a dependently-typed non-type template parameter. (This comes up when matching the parameters of a template template parameter against the parameters of a template template argument.) The matching rules here are murky at best. Our behavior after this revert is definitely wrong for certain C++17 features (for 'auto' template parameter types within the parameter list of a template template argument in particular), but our behavior before this revert is wrong for some pre-existing testcases, so reverting to our prior behavior seems like our best option. llvm-svn: 300262
* [Sema] Add __is_aggregate type-traitEric Fiselier2017-04-121-0/+7
| | | | | | | | | | | | | | | | Summary: [LWG 2911](http://cplusplus.github.io/LWG/lwg-defects.html#2911) adds `std::is_aggregate` to the library, which requires a new builtin trait. This patch implements `__is_aggregate`. Reviewers: rsmith, majnemer, aaron.ballman Reviewed By: aaron.ballman Subscribers: STL_MSFT, cfe-commits Differential Revision: https://reviews.llvm.org/D31513 llvm-svn: 300116
* Rangify for loop, NFC.Yaron Keren2017-04-121-3/+1
| | | | llvm-svn: 300043
* [Sema][ObjC] Check whether a variable has a definition, rather thanAkira Hatanaka2017-04-111-1/+1
| | | | | | | | | | | | | | | | checking its storage class, when determining whether casting a C pointer to an ObjC pointer is allowed. This change allows casting variables whose declarations are directly contained in a linkage specification to an ObjC pointer type. Those variables are treated as if they contain the extern specifier for the purpose of determining whether they are definitions or not. rdar://problem/29249853 Differential Revision: https://reviews.llvm.org/D31673 llvm-svn: 299992
* [ODRHash] Improve handling of hash valuesRichard Trieu2017-04-111-3/+1
| | | | | | | | | | | Calculating the hash in Sema::ActOnTagFinishDefinition could happen before all sub-Decls were parsed or processed, which would produce the wrong hash value. Change to calculating the hash on the first use and storing the value instead. Also, avoid using the macros that were only for Boolean fields and use an explicit checker during the DefintionData merge. No functional change, but was this blocking other ODRHash patches. llvm-svn: 299989
* Modular Codegen: Support homing debug info for types in modular objectsDavid Blaikie2017-04-111-2/+2
| | | | | | | | | Matching the function-homing support for modular codegen. Any type implicitly (implicit template specializations) or explicitly defined in a module is attached to that module's object file and omitted elsewhere (only a declaration used if necessary for references). llvm-svn: 299987
* Modular Codegen: Add/use a bit in serialized function definitions to track ↵David Blaikie2017-04-111-2/+2
| | | | | | | | | | | | | | | | | | | | | whether they are the subject of modular codegen Some decls are created not where they are written, but in other module files/users (implicit special members and function template implicit specializations). To correctly identify them, use a bit next to the definition to track the modular codegen property. Discussed whether the module file bit could be omitted in favor of reconstituting from the modular codegen decls list - best guess today is that the efficiency improvement of not having to deserialize the whole list whenever any function is queried by a module user is worth it for the small size increase of this redundant (list + bit-on-def) representation. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D29901 llvm-svn: 299982
* [OpenCL] Map default address space to alloca address spaceYaxun Liu2017-04-113-8/+11
| | | | | | | | | | | | | | For OpenCL, the private address space qualifier is 0 in AST. Before this change, 0 address space qualifier is always mapped to target address space 0. As now target private address space is specified by alloca address space in data layout, address space qualifier 0 needs to be mapped to alloca addr space specified by the data layout. This change has no impact on targets whose alloca addr space is 0. With contributions from Matt Arsenault, Tony Tye and Wen-Heng (Jack) Chung Differential Revision: https://reviews.llvm.org/D31404 llvm-svn: 299965
* Revert temporarily D29877 "Warn about unused static file scope function ↵Vassil Vassilev2017-04-112-18/+5
| | | | | | | | | | | | | template declarations." We need to address cases (breaking libc++) such as template <class _Up> static int __test(...); template<typename _Tp> auto v = __test<_Tp>(0); llvm-svn: 299956
* Warn about unused static file scope function template declarations.Vassil Vassilev2017-04-112-5/+18
| | | | | | Reviewed by Richard Smith (D29877)! llvm-svn: 299930
* Sema: prevent __declspec(naked) use on x64Saleem Abdulrasool2017-04-071-0/+11
| | | | | | | | | MSDN (https://msdn.microsoft.com/en-us/library/h5w10wxs.aspx) indicates that `__declspec(naked)` is only permitted on x86 and ARM targets. Testing with cl does confirm this behaviour. Provide a warning for use of `__declspec(naked)` on x64. llvm-svn: 299774
* [ObjC++] Conversions from specialized to non-specialized Objective-C genericAlex Lorenz2017-04-061-3/+17
| | | | | | | | | | | | | | | | | | | object types should be preferred over conversions to other object pointers This change ensures that Clang will select the correct overload for the following code sample: void overload(Base *b); void overload(Derived *d); void test(Base<Base *> b) { overload(b); // Select overload(Base *), not overload(Derived *) } rdar://20124827 Differential Revision: https://reviews.llvm.org/D31597 llvm-svn: 299648
* Fix lambda to block conversion in C++17 by avoiding copy elision for theAlex Lorenz2017-04-062-4/+20
| | | | | | | | | | | | | | | | lambda capture used by the created block The commit r288866 introduced guaranteed copy elision to C++ 17. This unfortunately broke the lambda to block conversion in C++17 (the compiler crashes when performing IRGen). This commit fixes the conversion by avoiding copy elision for the capture that captures the lambda that's used in the block created by the lambda to block conversion process. rdar://31385153 Differential Revision: https://reviews.llvm.org/D31669 llvm-svn: 299646
* [Sema] Extend GetSignedVectorType to deal with non ExtVector typesSimon Dardis2017-04-061-15/+36
| | | | | | | | | | | | | This improves some error messages which would otherwise refer to ext_vector_type types in contexts where there are no such types. Factored out from D25866 at reviewer's request. Reviewers: bruno Differential Revision: https://reviews.llvm.org/D31667 llvm-svn: 299641
* [Sema] Update CheckOverload docsGeorge Burgess IV2017-04-061-34/+33
| | | | | | | | | | | - Replace documented return values (true/false) with what's actually returned - Doxygenify the comment - Reflow said comment to 80 cols Not overly familiar with Doxygen, so nits are welcome. :) llvm-svn: 299603
* Simplify. NFC.George Burgess IV2017-04-061-8/+4
| | | | | | | | | | | | Two simplifications: - We check `!Previous.empty()` above and only use `Previous` in const contexts after that check, so the `!Previous.empty()` check seems redundant. - The null check looks pointless, as well: AFAICT, `LookupResults` should never contain null entries, and `OldDecl` should always be non-null if `Redeclaration` is true. llvm-svn: 299601
* [OpenCL] Extended diagnostics for atomic initializationEgor Churaev2017-04-052-1/+15
| | | | | | | | | | | | | | | | | | Summary: I saw the same changes in the following review: https://reviews.llvm.org/D17438 I don't know in that way I could determine that atomic variable was initialized by macro ATOMIC_VAR_INIT. Anyway I added check that atomic variables can be initialize only in global scope. I think that we can discuss this change. Reviewers: Anastasia, cfe-commits Reviewed By: Anastasia Subscribers: bader, yaxunl Differential Revision: https://reviews.llvm.org/D30643 llvm-svn: 299537
* [OpenCL] Enables passing sampler initializer to function argumentEgor Churaev2017-04-051-1/+1
| | | | | | | | | | | | Reviewers: Anastasia, cfe-commits Reviewed By: Anastasia Subscribers: yaxunl, bader Differential Revision: https://reviews.llvm.org/D31594 llvm-svn: 299524
* Don't issue a warning if the shadowing declaration is in a classStephan Bergmann2017-04-051-0/+4
| | | | | | | | | | | Follow-up to r299363 "Enhance -Wshadow to warn when shadowing typedefs or type aliases". Patch by Ahmed Asadi. Differential Revision: https://reviews.llvm.org/D31235 llvm-svn: 299522
* Add #pragma clang fpAdam Nemet2017-04-041-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | This adds the new pragma and the first variant, contract(on/off/fast). The pragma has the same block scope rules as STDC FP_CONTRACT, i.e. it can be placed at the beginning of a compound statement or at file scope. Similarly to STDC FP_CONTRACT there is no need to use attributes. First an annotate token is inserted with the parsed details of the pragma. Then the annotate token is parsed in the proper contexts and the Sema is updated with the corresponding FPOptions using the shared ActOn function with STDC FP_CONTRACT. After this the FPOptions from the Sema is propagated into the AST expression nodes. There is no change here. I was going to add a 'default' option besides 'on/off/fast' similar to STDC FP_CONTRACT but then decided against it. I think that we'd have to make option uppercase then to avoid using 'default' the keyword. Also because of the scoped activation of pragma I am not sure there is really a need a for this. Differential Revision: https://reviews.llvm.org/D31276 llvm-svn: 299470
* [Bug 25404] Fix crash on typedef in OpenCL 2.0Anastasia Stulova2017-04-041-1/+3
| | | | | | | | | | | | | | | Fixed the assertion due to absence of source location for implicitly defined types (using addImplicitTypedef()). During Sema checks the source location is being expected and therefore an assertion is triggered. The change is not specific to OpenCL. But it is particularly common for OpenCL types to be declared implicitly in Clang to support the mode without the standard header. Differential Revision: https://reviews.llvm.org/D31397 llvm-svn: 299447
* [coroutines] Fix rebuilding of implicit and dependent coroutine statements.Eric Fiselier2017-04-033-111/+182
| | | | | | | | | | | | | | | | | | | Summary: Certain implicitly generated coroutine statements, such as the calls to 'return_value()' or `return_void()` or `get_return_object_on_allocation_failure()`, cannot be built until the promise type is no longer dependent. This means they are not built until after the coroutine body statement has been transformed. This patch fixes an issue where these statements would never be built for coroutine templates. It also fixes a small issue where diagnostics about `get_return_object_on_allocation_failure()` were incorrectly suppressed. Reviewers: rsmith, majnemer, GorNishanov, aaron.ballman Reviewed By: GorNishanov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31487 llvm-svn: 299380
* Enhance -Wshadow to warn when shadowing typedefs or type aliasesAlex Lorenz2017-04-031-18/+55
| | | | | | | | | | | | Enhance -Wshadow to emit a warning when typedefs or type aliases are shadowed. Fixes bug https://bugs.llvm.org//show_bug.cgi?id=28676. Patch by Ahmed Asadi. Differential Revision: https://reviews.llvm.org/D31235 llvm-svn: 299363
OpenPOWER on IntegriCloud