summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* [OpenCL] Enable -fblocks by default for OpenCL 2.0 and above.Yaxun Liu2016-06-142-2/+2
| | | | | | Reviewed as part of http://reviews.llvm.org/D20444 llvm-svn: 272720
* Add loop pragma for Loop DistributionAdam Nemet2016-06-141-12/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is similar to other loop pragmas like 'vectorize'. Currently it only has state values: distribute(enable) and distribute(disable). When one of these is specified the corresponding loop metadata is generated: !{!"llvm.loop.distribute.enable", i1 true/false} As a result, loop distribution will be attempted on the loop even if Loop Distribution in not enabled globally. Analogously, with 'disable' distribution can be turned off for an individual loop even when the pass is otherwise enabled. There are some slight differences compared to the existing loop pragmas. 1. There is no 'assume_safety' variant which makes its handling slightly different from 'vectorize'/'interleave'. 2. Unlike the existing loop pragmas, it does not have a corresponding numeric pragma like 'vectorize' -> 'vectorize_width'. So for the consistency checks in CheckForIncompatibleAttributes we don't need to check it against other pragmas. We just need to check for duplicates of the same pragma. Reviewers: rsmith, dexonsmith, aaron.ballman Subscribers: bob.wilson, cfe-commits, hfinkel Differential Revision: http://reviews.llvm.org/D19403 llvm-svn: 272656
* Reverting "Warn when taking address of a packed member"Roger Ferrer Ibanez2016-06-141-24/+0
| | | | | | | | This new diagnostic is causing some false positives that have to be addressed. This reverts commit 272552 llvm-svn: 272653
* Fix PR28100 - Allow redeclarations of deleted explicit specializations.Faisal Vali2016-06-141-6/+14
| | | | | | | | | | | | See https://llvm.org/bugs/show_bug.cgi?id=28100. In r266561 when I implemented allowing explicit specializations of function templates to override deleted status, I mistakenly assumed (and hence introduced a violable assertion) that when an explicit specialization was being declared, the corresponding specialization of the most specialized function template that it would get linked to would always be the one that was implicitly generated - and so if it was marked as 'deleted' it must have inherited it from the primary template and so should be safe to reset its deleted status, and set it to being an explicit specialization. Obviously during redeclaration of a deleted explicit specialization, in order to avoid a recursive reset, we need to check that the previous specialization is not an explicit specialization (instead of assuming and asserting it) and that it hasn't been referenced, and so only then is it safe to reset its 'deleted' status. All regression tests pass. Thanks to Zhendong Su for reporting the bug and David Majnemer for tracking it to my commit r266561, and promptly bringing it to my attention. llvm-svn: 272631
* Detect recursive default argument definitionSerge Pavlov2016-06-141-0/+7
| | | | | | | | | | | | If definition of default function argument uses itself, clang crashed, because corresponding function parameter is not associated with the default argument yet. With this fix clang emits appropriate error message. This change fixes PR28105. Differential Revision: http://reviews.llvm.org/D21301 llvm-svn: 272623
* Warn when taking address of a packed memberRoger Ferrer Ibanez2016-06-131-0/+24
| | | | | | | | | | | | | | | | | This patch implements PR#22821. Taking the address of a packed member is dangerous since the reduced alignment of the pointee is lost. This can lead to memory alignment faults in some architectures if the pointer value is dereferenced. This change adds a new warning to clang emitted when taking the address of a packed member. A packed member is either a field/data member declared as attribute((packed)) or belonging to a struct/class declared as such. The associated flag is -Waddress-of-packed-member Differential Revision: http://reviews.llvm.org/D20561 llvm-svn: 272552
* Fix cv-qualification of '*this' captures and nasty bug PR27507 Faisal Vali2016-06-112-25/+118
| | | | | | | | | | | | | The bug report by Gonzalo (https://llvm.org/bugs/show_bug.cgi?id=27507 -- which results in clang crashing when generic lambdas that capture 'this' are instantiated in contexts where the Functionscopeinfo stack is not in a reliable state - yet getCurrentThisType expects it to be) - unearthed some additional bugs in regards to maintaining proper cv qualification through 'this' when performing by value captures of '*this'. This patch attempts to correct those bugs and makes the following changes: o) when capturing 'this', we do not need to remember the type of 'this' within the LambdaScopeInfo's Capture - it is never really used for a this capture - so remove it. o) teach getCurrentThisType to walk the stack of lambdas (even in scenarios where we run out of LambdaScopeInfo's such as when instantiating call operators) looking for by copy captures of '*this' and resetting the type of 'this' based on the constness of that capturing lambda's call operator. This patch has been baking in review-hell for > 6 weeks - all the comments so far have been addressed and the bug (that it addresses in passing, and I regret not submitting as a separate patch initially) has been reported twice independently, so is frequent and important for us not to just sit on. I merged the cv qualification-fix and the PR-fix initially in one patch, since they resulted from my initial implementation of star-this and so were related. If someone really feels strongly, I can put in the time to revert this - separate the two out - and recommit. I won't claim it's immunized against all bugs, but I feel confident enough about the fix to land it for now. llvm-svn: 272480
* [AVX512] Implement masked and 512-bit pshufd intrinsics directly with ↵Craig Topper2016-06-111-3/+0
| | | | | | __builtin_shufflevector and __builtin_ia32_select. llvm-svn: 272467
* [AVX512] Implement 512-bit and masked shufflelo and shufflehi intrinsics ↵Craig Topper2016-06-111-6/+0
| | | | | | directly with __builtin_shufflevector and __builtin_ia32_select. Also improve the formatting of the AVX2 version. llvm-svn: 272452
* [Sema] Return an appropriate result from CheckSpecifiedExceptionTypeDavid Majnemer2016-06-111-2/+5
| | | | | | | | We shouldn't return true from CheckSpecifiedExceptionType if the record type is incomplete and -fms-extensions is engaged. Otherwise we will have an incomplete AST. llvm-svn: 272447
* Revise RenderScript attribute declarationPirama Arumuga Nainar2016-06-101-13/+2
| | | | | | | | | | | | | | | | Summary: Address post-patch comments to r272342. - Rename the 'kernel' attribute's name - Idiomatically restrict the attribute to the 'RenderScript' LangOpt. Reviewers: aaron.ballman, rsmith Subscribers: cfe-commits, srhines Differential Revision: http://reviews.llvm.org/D21240 llvm-svn: 272438
* Remove a few gendered pronouns.Nico Weber2016-06-104-7/+6
| | | | llvm-svn: 272415
* [-fms-extensions] Permit incomplete types in dynamic exception specificationsDavid Majnemer2016-06-101-2/+5
| | | | | | | | | | Microsoft headers, comdef.h and comutil.h, assume that this is an OK thing to do. Downgrade the hard error to a warning if we are in -fms-extensions mode. This fixes PR28080. llvm-svn: 272412
* Fix recognition of shadowed template parameterSerge Pavlov2016-06-101-6/+8
| | | | | | | | | | | | | | | | | | | | | | | Crash reported in PR28023 is caused by the fact that non-type template parameters are found by tag name lookup. In the code provided in that PR: template<int V> struct A { struct B { template <int> friend struct V; }; }; the template parameter V is found when lookup for redeclarations of 'struct V' is made. Latter on the error about shadowing of 'V' is emitted but the semantic context of 'struct V' is already determined wrong: 'struct A' instead of translation unit. The fix moves the check for shadowing toward the beginning of the method and thus prevents from wrong context calculations. This change fixes PR28023. llvm-svn: 272366
* Remove CXXConstructExpr::getFoundDecl(); it turned out to not be useful.Richard Smith2016-06-103-12/+22
| | | | llvm-svn: 272357
* RenderScript support in the FrontendPirama Arumuga Nainar2016-06-091-0/+15
| | | | | | | | | | | | | | | | | | | | | Summary: Create a new Frontend LangOpt to specify the renderscript language. It is enabled by the "-x renderscript" option from the driver. Add a "kernel" function attribute only for RenderScript (an "ignored attribute" warning is generated otherwise). Make the NativeHalfType and NativeHalfArgsAndReturns LangOpts be implied by the RenderScript LangOpt. Reviewers: rsmith Subscribers: cfe-commits, srhines Differential Revision: http://reviews.llvm.org/D21198 llvm-svn: 272342
* Revert "[Temporary] Add an ExprWithCleanups for each C++ ↵Tim Shen2016-06-0911-83/+48
| | | | | | | | | MaterializeTemporaryExpr." This reverts r272296, since there are clang-tidy failures that appear to be caused by this change. llvm-svn: 272310
* [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr.Tim Shen2016-06-0911-48/+83
| | | | | | | | | | | These ExprWithCleanups are added for holding a RunCleanupsScope not for destructor calls; rather, they are for lifetime marks. This requires ExprWithCleanups to keep a bit to indicate whether it have cleanups with side effects (e.g. dtor calls). Differential Revision: http://reviews.llvm.org/D20498 llvm-svn: 272296
* CIndex: add support for static_assertOlivier Goffart2016-06-091-0/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D18080 llvm-svn: 272273
* [Sema] Don't crash when a field w/ a mem-initializer clashes with a record nameDavid Majnemer2016-06-091-2/+1
| | | | | | | | | | | It is possible for a field and a class to have the same name. In such cases, performing lookup for the field might return a result set with more than one entry. An overzealous assertion fired, causing us to crash instead of using the non-class lookup result. This fixes PR28060. llvm-svn: 272247
* [Sema] Don't permit catching variably modified typesDavid Majnemer2016-06-081-0/+5
| | | | | | | | Variably modified types shouldn't be permitted in catch clauses. This fixes PR28047. llvm-svn: 272159
* Correcting a typo in a comment; NFC.Aaron Ballman2016-06-081-1/+1
| | | | llvm-svn: 272136
* [Sema] Teach CheckPlaceholderExpr about unaddressable functions.George Burgess IV2016-06-083-25/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given the following C++: ``` void foo(); void foo() __attribute__((enable_if(false, ""))); bool bar() { auto P = foo; return P == foo; } ``` We'll currently happily (and correctly) resolve `foo` to the `foo` overload without `enable_if` when assigning to `P`. However, we'll complain about an ambiguous overload on the `P == foo` line, because `Sema::CheckPlaceholderExpr` doesn't recognize that there's only one `foo` that could possibly work here. This patch teaches `Sema::CheckPlaceholderExpr` how to properly deal with such cases. Grepping for other callers of things like `Sema::ResolveAndFixSingleFunctionTemplateSpecialization`, it *looks* like this is the last place that needed to be fixed up. If I'm wrong, I'll see if there's something we can do that beats what amounts to whack-a-mole with bugs. llvm-svn: 272080
* [OPENCL] Fix wrongly vla error for OpenCL array.Xiuli Pan2016-06-071-1/+2
| | | | | | | | | | | | | | | | | Summary: OpenCL should support array with const value size length, those const varibale in global and constant address space and variable in constant address space. Fixed test case error. Reviewers: Anastasia, yaxunl, bader Subscribers: bader, cfe-commits Differential Revision: http://reviews.llvm.org/D20090 llvm-svn: 271978
* Revert "[OPENCL] Fix wrongly vla error for OpenCL array."Xiuli Pan2016-06-071-2/+1
| | | | | | | | Test case break on system-z. This reverts commit 9a7212e1e87f1396952d74f8c62314a775ccbb1c. llvm-svn: 271975
* [OPENCL] Fix wrongly vla error for OpenCL array.Xiuli Pan2016-06-071-1/+2
| | | | | | | | | | | | | Summary: OpenCL should support array with const value size length, those const varibale in global and constant address space and variable in constant address space. Reviewers: Anastasia, yaxunl, bader Subscribers: bader, cfe-commits Differential Revision: http://reviews.llvm.org/D20090 llvm-svn: 271971
* [CUDA] Add implicit conversion of __launch_bounds__ arguments to rvalue.Artem Belevich2016-06-061-14/+27
| | | | | | | | Fixes clang crash reported in PR27778. Differential Revision: http://reviews.llvm.org/D20985 llvm-svn: 271951
* FixIt: use getLocForEndOfToken to insert fix-it after a type name.Manman Ren2016-06-021-1/+2
| | | | | | | | | | | | | | | | Instead of setting DeclSpec's range end to point to the next token after the DeclSpec, we use getLocForEndOfToken to insert fix-it after a type name. Before this fix, fix-it will change ^(NSView view) to ^(*NSView view) This commit correctly updates the source to ^(NSView* view). rdar://21042144 Differential Revision: http://reviews.llvm.org/D20844 llvm-svn: 271448
* [Sema] Fix incorrect enum token namespaceEtienne Bergeron2016-06-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch fix the scoping of enum literal. They were not resolving to the right type. It was not causing any problem as one is a copy of the other one. The literal in the switch are resolving to Sema.h:5527 ``` enum AccessResult { AR_accessible, AR_inaccessible, AR_dependent, AR_delayed }; ``` Instead of SemaAccess.cpp:27 ``` /// A copy of Sema's enum without AR_delayed. enum AccessResult { AR_accessible, AR_inaccessible, AR_dependent }; ``` This issue was found by a new clang-tidy check (still on-going). Reviewers: rsmith, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20773 llvm-svn: 271431
* ObjC lifetime: pull sugar off when the qualifiers conflict.Manman Ren2016-06-011-4/+6
| | | | | | | | | | | | It's possible to have multiple local ObjCLifetime qualifiers. When there is a conflict, we can't stop after we reach a type that is directly qualified. We need to keep pulling sugar off and removing the ObjCLifetime qualifers. rdar://25804796 Differential Revision: http://reviews.llvm.org/D20843 llvm-svn: 271409
* It seems we need to add SemaExpr.cpp to the /bigobj list; I am getting ↵Aaron Ballman2016-06-011-0/+4
| | | | | | consistent failures of hitting the section count limit. llvm-svn: 271399
* [MSVC] Fix stack overflow in unqualified type lookup logic, by WillAlexey Bataev2016-05-311-5/+11
| | | | | | | | | | Wilson. An unqualified lookup for in base classes may cause stack overflow if the base class is a specialization of current class. Patch by Will Wilson. llvm-svn: 271251
* [OpenMP] Fix SEMA bug in the capture of global variables in template functions.Samuel Antao2016-05-271-2/+4
| | | | | | | | | | | | | | Summary: Target regions require globals to be captured. This patch fixes a bug exposed when that happens in a template function. Reviewers: hfinkel, arpith-jacob, kkwli0, carlo.bertolli, ABataev Subscribers: guansong, ABataev, cfe-commits, caomhin, fraggamuffin Differential Revision: http://reviews.llvm.org/D18110 llvm-svn: 271001
* Turn copies into references as suggested by clang-tidy's ↵Benjamin Kramer2016-05-271-2/+2
| | | | | | performance-unnecessary-copy-initialization. llvm-svn: 270994
* Produce better pretty stack traces from crashes in template instantiation: addRichard Smith2016-05-263-6/+17
| | | | | | | | pretty stack trace entries for all cases where we instantiate the definition of something, and include the fully-qualified name with template arguments in the name of the instantiated entity. llvm-svn: 270904
* Re-commit r270748 "clang-cl: Treat dllimport explicit template instantiation ↵Hans Wennborg2016-05-262-2/+38
| | | | | | | | | | definitions as declarations (PR27810, PR27811)" Also make explicit instantiation decls not apply to nested classes when targeting MSVC. That dll attributes are not inherited by inner classes might be the explanation for MSVC's behaviour here. llvm-svn: 270897
* [OpenMP] Parsing and sema support for the from clauseSamuel Antao2016-05-262-6/+53
| | | | | | | | | | | | | | | Summary: The patch contains the parsing and sema support for the `from` clause. Patch based on the original post by Kelvin Li. Reviewers: hfinkel, carlo.bertolli, kkwli0, arpith-jacob, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D18488 llvm-svn: 270882
* [OpenMP] Parsing and sema support for the to clauseSamuel Antao2016-05-262-97/+197
| | | | | | | | | | | | | | | Summary: The patch contains the parsing and sema support for the `to` clause. Patch based on the original post by Kelvin Li. Reviewers: carlo.bertolli, hfinkel, kkwli0, arpith-jacob, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D18597 llvm-svn: 270880
* [OpenMP] Parsing and sema support for target update directiveSamuel Antao2016-05-262-1/+33
| | | | | | | | | | | | | | | Summary: This patch is to add parsing and sema support for `target update` directive. Support for the `to` and `from` clauses will be added by a different patch. This patch also adds support for other clauses that are already implemented upstream and apply to `target update`, e.g. `device` and `if`. This patch is based on the original post by Kelvin Li. Reviewers: hfinkel, carlo.bertolli, kkwli0, arpith-jacob, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D15944 llvm-svn: 270878
* Fix crash while parsing variable template with variadic template argumentsOlivier Goffart2016-05-261-1/+1
| | | | | | | | | | It is only a crash if the compiler optimize for this!=nullptr because LocalInstantiationScope::getPartiallySubstitutedPack checks if 'this' is null (This is crashing when clang is compiled with GCC6) Differential Revision: http://reviews.llvm.org/D20511 llvm-svn: 270845
* [MSVC] Support for __unaligned qualifier in functionsAndrey Bokhanko2016-05-263-3/+5
| | | | | | | | | | | | | | | This implements support for MS-specific __unaligned qualifier in functions and makes the following test case both compile and mangle correctly: struct S { void f() __unaligned; }; void S::f() __unaligned { } Differential Revision: http://reviews.llvm.org/D20437 llvm-svn: 270834
* [ObjC] Remove _Atomic from return type and parameter type ofAkira Hatanaka2016-05-261-8/+16
| | | | | | | | | | | | | | objective-c properties. This fixes an assert in CodeGen that fires when the getter and setter functions for an objective-c property of type _Atomic(_Bool) are synthesized. rdar://problem/26322972 Differential Revision: http://reviews.llvm.org/D20407 llvm-svn: 270808
* Revert r270748 "clang-cl: Treat dllimport explicit template instantiation ↵Hans Wennborg2016-05-251-31/+2
| | | | | | | | | definitions as declarations (PR27810, PR27811)" It seems to have broken the sanitizer-windows bot. Reverting while investigating. llvm-svn: 270754
* clang-cl: Treat dllimport explicit template instantiation definitions as ↵Hans Wennborg2016-05-251-2/+31
| | | | | | | | | | | declarations (PR27810, PR27811) This matches what MSVC does, and should make compiles faster by avoiding to unnecessarily emit a lot of code. Differential Revision: http://reviews.llvm.org/D20608 llvm-svn: 270748
* [OPENMP 4.5] Codegen for dacross loop synchronization constructs.Alexey Bataev2016-05-252-62/+141
| | | | | | | OpenMP 4.5 adds support for doacross loop synchronization. Patch implements codegen for this construct. llvm-svn: 270690
* [ms][dll] #26935 Defining a dllimport function should cause it to be exportedDenis Zobnin2016-05-251-17/+35
| | | | | | | | | | | | | | | | | | | If we have some function with dllimport attribute and then we have the function definition in the same module but without dllimport attribute we should add dllexport attribute to this function definition. The same should be done for variables. Example: struct __declspec(dllimport) C3 { ~C3(); }; C3::~C3() {;} // we should export this definition. Patch by Andrew V. Tischenko Differential revision: http://reviews.llvm.org/D18953 llvm-svn: 270686
* Rename a variable to avoid shadowing function parameter. NFC.Bob Wilson2016-05-251-7/+7
| | | | llvm-svn: 270666
* arc-repeated-use-of-weak should not warn about IBOutlet propertiesBob Wilson2016-05-252-1/+7
| | | | | | | | | | | | | | Revision r211132 was supposed to disable -Warc-repeated-use-of-weak for Objective-C properties marked with the IBOutlet attribute. Those properties are supposed to be weak but they are only accessed from the main thread so there is no risk of asynchronous updates setting them to nil. That combination makes -Warc-repeated-use-of-weak very noisy. The previous change only handled one kind of access to weak IBOutlet properties. Instead of trying to add checks for all the different kinds of property accesses, this patch removes the previous special case check and adds a check at the point where the diagnostic is reported. rdar://21366461 llvm-svn: 270665
* [ms] Allow more unqualified lookup of types in dependent base classesReid Kleckner2016-05-241-11/+47
| | | | | | | | | | | | | | | | | | | Summary: In dependent contexts where we know a type name is required, such as a new expression, we can recover by forming a DependentNameType. This generalizes our existing compatibility hack for default arguments for template type parameters. Works towards parsing atlctrlw.h, which is PR26748. Reviewers: avt77, rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20500 llvm-svn: 270615
* [modules] Ask the canonical decl whether the constructor was defaulted.Vassil Vassilev2016-05-241-4/+4
| | | | | | | | | | | In case of template instantiations query the template instantiation pattern, which had actually '=default'. Fixes https://llvm.org/bugs/show_bug.cgi?id=27739 Patch reviewed by Richard Smith. llvm-svn: 270553
OpenPOWER on IntegriCloud