summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [OpenMP] Update map clause SEMA to support OpenMP 4.5 possible list items.Samuel Antao2016-01-221-97/+467
| | | | | | | | | | | | | | | | | Summary: Extend support in the map clause SEMA for the expressions supported in the OpenMP 4.5 specification, namely member expressions. Fix some bugs in the previous implementation of SEMA related with expressions that do not consist of single variable references. Fix bug in parsing when the expression in the map clause do not start with an identifier: accept any expression in the map clause and check for validity in SEMA instead of just ignoring it. Reviewers: hfinkel, kkwli0, arpith-jacob, carlo.bertolli, ABataev Subscribers: cfe-commits, fraggamuffin, caomhin Differential Revision: http://reviews.llvm.org/D16385 llvm-svn: 258543
* [OpenMP] Check for at least one map clause on target data directive.Arpith Chacko Jacob2016-01-211-0/+8
| | | | | | | | | | | | | | Summary: Adds the following restriction in the OpenMP specifications. OpenMP [2.10.1, Restrictions, p. 97] At least one map clause must appear on the directive. Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16341 llvm-svn: 258425
* Fix crash for typedefs for arrays of runtime bounds in Lambdas/Captured ↵Alexey Bataev2016-01-211-114/+137
| | | | | | Statements, used in sizeof() expression only. llvm-svn: 258396
* [OPENMP 4.5] Allow to use non-static data members in non-static member ↵Alexey Bataev2016-01-202-140/+219
| | | | | | | | functions in 'private' clause. OpenMP 4.5 allows to use non-static members of current class in non-static member functions in 'private' clause. Patch adds initial support for privatizing data members. llvm-svn: 258299
* [CUDA] Bail, rather than crash, on va_arg in device code.Justin Lebar2016-01-201-3/+11
| | | | | | | | | | Reviewers: tra Subscribers: echristo, jhen, cfe-commits Differential Revision: http://reviews.llvm.org/D16331 llvm-svn: 258264
* [CUDA] Only allow __global__ on free functions and static member functions.Justin Lebar2016-01-202-7/+14
| | | | | | | | | | | | | | Summary: Warn for NVCC compatibility if you declare a static member function or inline function as __global__. Reviewers: tra Subscribers: jhen, echristo, cfe-commits Differential Revision: http://reviews.llvm.org/D16261 llvm-svn: 258263
* Allow __attribute__((mode)) to appertain to field declarations again. ↵Aaron Ballman2016-01-191-2/+2
| | | | | | | | Corrects compile issues with LibreOffice. Patch by Stephan Bergmann llvm-svn: 258213
* [OpenMP] Detect implicit map type to report unspecified map type for target ↵Samuel Antao2016-01-192-26/+30
| | | | | | | | | | | | | | | | | | | | enter/exit data directives. Support for the following OpenMP 4.5 restriction on 'target enter data' and 'target exit data': - A map-type must be specified in all map clauses. I have to save 'IsMapTypeImplicit' when parsing a map clause to support this constraint and for more informative error messages. This helps me support the following case: #pragma omp target enter data map(r) // expected-error {{map type must be specified for '#pragma omp target enter data'}} and distinguish it from: #pragma omp target enter data map(tofrom: r) // expected-error {{map type 'tofrom' is not allowed for '#pragma omp target enter data'}} Patch by Arpith Jacob. Thanks! llvm-svn: 258179
* [OpenMP] Parsing + sema for "target exit data" directive.Samuel Antao2016-01-192-0/+89
| | | | | | Patch by Arpith Jacob. Thanks! llvm-svn: 258177
* [OpenMP] Parsing + sema for "target enter data" directive.Samuel Antao2016-01-192-3/+104
| | | | | | Patch by Arpith Jacob. Thanks! llvm-svn: 258165
* Activate OpenMP private clause for target construct and a regression test.Carlo Bertolli2016-01-191-1/+1
| | | | llvm-svn: 258140
* Fix PR26134: When substituting into default template arguments, keep ↵Faisal Vali2016-01-191-1/+0
| | | | | | | | | | | | | | | CurContext unchanged. Or, do not set Sema's CurContext to the template declaration's when substituting into default template arguments of said template declaration. If we do push the template declaration context on to Sema, and the template declaration is at namespace scope, Sema can get confused and try and do odr analysis when substituting into default template arguments, even though the substitution could be occurring within a dependent context. I'm not sure why this was being done, perhaps there was concern that if a default template argument referred to a previous template parameter, it might not be found during substitution - but all regression tests pass, and I can't craft a test that would cause it to fails (if some one does, please inform me, and i'll craft a different fix for the PR). This patch removes a single line of code, but unfortunately adds more than it removes, because of the tests. Some day I still hope to commit a patch that removes far more lines than it adds, while leaving clang better for it ;) Sorry that r253590 ("Change the expression evaluation context from Unevaluated to ConstantEvaluated while substituting into non-type template argument defaults") caused the PR! llvm-svn: 258110
* Introduce -fsanitize-stats flag.Peter Collingbourne2016-01-161-1/+1
| | | | | | | | | This is part of a new statistics gathering feature for the sanitizers. See clang/docs/SanitizerStats.rst for further info and docs. Differential Revision: http://reviews.llvm.org/D16175 llvm-svn: 257971
* OpaquePtr: Use nullptr construction for ParsedType OpaquePtr typedefDavid Blaikie2016-01-154-28/+28
| | | | llvm-svn: 257958
* OpaquePtr: Use nullptr construction for DeclGroupPtrTy OpaquePtr typedefDavid Blaikie2016-01-151-1/+1
| | | | llvm-svn: 257956
* Make -Wdelete-non-virtual-dtor warn on explicit `a->~A()` dtor calls too.Nico Weber2016-01-152-24/+54
| | | | | | | | | | | | | | | | | | | | | | | -Wdelete-non-virtual-dtor warns if A is a type with virtual functions but without virtual dtor has its constructor called via `delete a`. This makes the warning also fire if the dtor is called via `a->~A()`. This would've found a security bug in Chromium at compile time. Fixes PR26137. To fix the warning, add a virtual destructor, make the class final, or remove its other virtual methods. If you want to silence the warning, there's also a fixit that shows how: test.cc:12:3: warning: destructor called on 'B' ... [-Wdelete-non-virtual-dtor] b->~B(); ^ test.cc:12:6: note: qualify call to silence this warning b->~B(); ^ B:: http://reviews.llvm.org/D16206 llvm-svn: 257939
* Add OpenMP dist_schedule clause to distribute directive and related ↵Carlo Bertolli2016-01-152-0/+85
| | | | | | regression tests. llvm-svn: 257917
* PR26111: segmentation fault with __attribute__((mode(QI))) on function ↵Alexey Bataev2016-01-151-8/+3
| | | | | | | | | declaration, by Denis Zobnin Allow "mode" attribute to be applied to VarDecl, not ValueDecl (which includes FunctionDecl and EnumConstantDecl), emit an error if this attribute is used with function declarations and enum constants. Differential Revision: http://reviews.llvm.org/D16112 llvm-svn: 257868
* [X86] Support 'interrupt' attribute for x86Alexey Bataev2016-01-152-6/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This attribute may be attached to a function definition and instructs the backend to generate appropriate function entry/exit code so that it can be used directly as an interrupt handler. The IRET instruction, instead of the RET instruction, is used to return from interrupt or exception handlers. All registers, except for the EFLAGS register which is restored by the IRET instruction, are preserved by the compiler. Any interruptible-without-stack-switch code must be compiled with -mno-red-zone since interrupt handlers can and will, because of the hardware design, touch the red zone. interrupt handler must be declared with a mandatory pointer argument: struct interrupt_frame; __attribute__ ((interrupt)) void f (struct interrupt_frame *frame) { ... } and user must properly define the structure the pointer pointing to. exception handler: The exception handler is very similar to the interrupt handler with a different mandatory function signature: #ifdef __x86_64__ typedef unsigned long long int uword_t; #else typedef unsigned int uword_t; #endif struct interrupt_frame; __attribute__ ((interrupt)) void f (struct interrupt_frame *frame, uword_t error_code) { ... } and compiler pops the error code off stack before the IRET instruction. The exception handler should only be used for exceptions which push an error code and all other exceptions must use the interrupt handler. The system will crash if the wrong handler is used. Differential Revision: http://reviews.llvm.org/D15709 llvm-svn: 257867
* [Sema] Suppress diags in overload resolution.George Burgess IV2016-01-134-93/+124
| | | | | | | | | | We were emitting diagnostics from our shiny new C-only overload resolution mode. This patch attempts to silence all such diagnostics. This fixes PR26085. Differential Revision: http://reviews.llvm.org/D16159 llvm-svn: 257710
* [Bugfix] Fix ICE on constexpr vector splat.George Burgess IV2016-01-135-29/+48
| | | | | | | | | | | | | In {CG,}ExprConstant.cpp, we weren't treating vector splats properly. This patch makes us treat splats more properly. Additionally, this patch adds a new cast kind which allows a bool->int cast to result in -1 or 0, instead of 1 or 0 (for true and false, respectively), so we can sanely model OpenCL bool->int casts in the AST. Differential Revision: http://reviews.llvm.org/D14877 llvm-svn: 257559
* [CUDA] Report an error if code tries to mix incompatible CUDA attributes.Justin Lebar2016-01-131-13/+35
| | | | | | | | | | | | Summary: Thanks to jhen for helping me figure this out. Reviewers: tra, echristo Subscribers: jhen Differential Revision: http://reviews.llvm.org/D16129 llvm-svn: 257554
* Improve AST dumping:Richard Smith2016-01-121-0/+16
| | | | | | | | 1) When dumping a declaration that declares a name for a type, also dump the named type. 2) Add a #pragma clang __debug dump X, that dumps the lookup results for X in the current context. llvm-svn: 257529
* [modules] Don't diagnose a conflict between two using-declarations that name ↵Richard Smith2016-01-121-0/+4
| | | | | | equivalent internal linkage entities. llvm-svn: 257512
* When a tag is declared in prototype scope in C, if we've decided that itRichard Smith2016-01-111-4/+4
| | | | | | | | | | | | | | redeclares an existing tag but are creating a new declaration anyway (because it has attributes or changes the visibility of the name), don't warn that it won't be visible outside the current scope. That's not true. Also narrow down the set of cases where we create these extra declarations when building modules; previously, all tag declarations but the first in a module header would get this treatment if -fmodules-local-submodule-visibility. (This isn't a functional change, but we try to avoid creating these extra declarations whenever we can.) llvm-svn: 257403
* [Sema] Issue a warning for integer overflow in struct initializerAkira Hatanaka2016-01-111-0/+4
| | | | | | | | | | | | | | | | Clang wasn't issuing a warning when compiling the following code: struct s { unsigned x; } s = { .x = 4 * 1024 * 1024 * 1024 }; rdar://problem/23399683 Differential Revision: http://reviews.llvm.org/D15097 llvm-svn: 257357
* Fix assert hit when tree-transforming template template parameter packs.Manuel Klimek2016-01-111-1/+1
| | | | | | | | | Covers significantly more code in the template template pack argument test and fixes the resulting assert problem. Differential Revision: http://reviews.llvm.org/D15743 llvm-svn: 257326
* [OpenCL] Pipe type supportXiuli Pan2016-01-0910-2/+131
| | | | | | | | | | | | | | | Summary: Support for OpenCL 2.0 pipe type. This is a bug-fix version for bader's patch reviews.llvm.org/D14441 Reviewers: pekka.jaaskelainen, Anastasia Subscribers: bader, Anastasia, cfe-commits Differential Revision: http://reviews.llvm.org/D15603 llvm-svn: 257254
* [modules] If we're treating an elaborated-type-specifier as if it introduces aRichard Smith2016-01-091-15/+30
| | | | | | | | tag (because the previous declaration was found in a different module), inject the tag into the appropriate scope (that is, the enclosing scope if we're in a function prototype scope in C++). llvm-svn: 257251
* Only take NULL macros instead of all macros into account for -Wnull-conversion.Richard Trieu2016-01-091-2/+6
| | | | llvm-svn: 257240
* Exclude function calls for functions which have return type nullptr_t fromRichard Trieu2016-01-081-0/+4
| | | | | | | | | -Wnull-conversion warning. These functions are basically equivalent to other pointer returning fuctions which are already excluded by -Wnull-conversion. llvm-svn: 257231
* Properly track that a character literal is UTF-8, and pretty print the ↵Aaron Ballman2016-01-073-0/+6
| | | | | | prefix properly. llvm-svn: 257097
* [Sema] Teach overload resolution about unaddressable functions.George Burgess IV2016-01-072-4/+39
| | | | | | | | | | | | Given an expression like `(&Foo)();`, we perform overload resolution as if we are calling `Foo` directly. This causes problems if `Foo` is a function that can't have its address taken. This patch teaches overload resolution to ignore functions that can't have their address taken in such cases. Differential Revision: http://reviews.llvm.org/D15590 llvm-svn: 257016
* Properly bind up any cleanups in an ExprWithCleanups afterJohn McCall2016-01-061-6/+5
| | | | | | | | | | instantiating a default argument expression. This was previously just working implicitly by reinstantiating in the current context, but caching means that we weren't registering cleanups in subsequent uses. llvm-svn: 256996
* Only instantiate a default argument once.John McCall2016-01-061-1/+8
| | | | | | | | | | | | | | | | | | | By storing the instantiated expression back in the ParmVarDecl, we remove the last need for separately storing the sub-expression of a CXXDefaultArgExpr. This makes PCH/Modules merging quite simple: CXXDefaultArgExpr records are serialized as references to the ParmVarDecl, and we ignore redundant attempts to overwrite the instantiated expression. This has some extremely marginal impact on user-facing semantics. However, the major effect is that it avoids IRGen errors about conflicting definitions due to lambdas in the argument being instantiated multiple times while sharing the same mangling. It should also slightly improve memory usage and module file size. rdar://23810407 llvm-svn: 256983
* Fix half of PR26048. We don't yet diagnose the case where the anonymous ↵Richard Smith2016-01-061-8/+7
| | | | | | union member is declared first and the tag name is declared second. llvm-svn: 256979
* Improve conditional checking during template instantiation.Richard Trieu2016-01-061-3/+5
| | | | | | | | | | | | | When the condition in an if statement, while statement, or for loop is created during template instantiation, it calls MakeFullExpr with only the condition expression. However, when these conditions are created for non-templated code in the Parser, an additional SourceLocation is passed to MakeFullExpr. The impact of this was that non-dependent templated code could produce diagnostics that the same code outside templates would not. Adding the missing SourceLocation makes diagnostics consistent between templated and non-templated code. llvm-svn: 256976
* [modules] When a tag type that was imported from a module is referenced via anRichard Smith2016-01-061-10/+29
| | | | | | | elaborated-type-specifier, create a declaration of it to track that the current module makes it visible too. llvm-svn: 256907
* Avoid walking all the declarations in the TU when a tag is declared in functionRichard Smith2016-01-051-6/+2
| | | | | | prototype scope in a function definition. llvm-svn: 256803
* Remove an unused parameterDavid Majnemer2016-01-051-4/+1
| | | | | | No functionality change is intended llvm-svn: 256797
* [ms-inline-asm] Handle dependent identifiers in inline asmDavid Majnemer2016-01-041-4/+13
| | | | | | | | | Build up a dependent expression for MS-style inline assembly if the identifier's type is dependent. This fixes PR26001. llvm-svn: 256795
* [MSVC Compat] Diagnose multiple default ctors for dllexport'd classesDavid Majnemer2015-12-311-1/+23
| | | | | | | | | | | | | | | | | The MS ABI emits a special default constructor closure thunk if a default constructor has a weird calling convention or default arguments. The MS ABI has a quirk: there can be only one such thunk because the mangling scheme does not have room for distinct manglings. We must raise a diagnostic in this eventuality. N.B. MSVC sorta gets this right. Multiple default constructors result in the default constructor closure getting emitted but they seem to get confused by which default constructors are reasonable to reference from the closure. We try to be a little more careful which results in mild differences in behavior. llvm-svn: 256661
* [TrailingObjects] Convert classes in ExprObjC.hJames Y Knight2015-12-311-3/+3
| | | | llvm-svn: 256659
* Improve diagnostic for the case where a function template candidate is rejectedRichard Smith2015-12-312-6/+58
| | | | | | | | by overload resolution because deduction succeeds, but the substituted parameter type for some parameter (with deduced type) doesn't exactly match the corresponding adjusted argument type. llvm-svn: 256657
* Implement [temp.deduct.type]p6: if the nested-name-specifier of a type isRichard Smith2015-12-301-10/+14
| | | | | | dependent, the type is a non-deduced context. llvm-svn: 256651
* When performing an implicit from float to bool, the floating point value ↵Aaron Ballman2015-12-301-1/+1
| | | | | | | | must be *exactly* zero in order for the conversion to result in 0. This does not involve a conversion through an integer value, and so truncation of the value is not performed. This patch address PR25876. llvm-svn: 256643
* [OPENMP 4.5] Allow 'ordered' clause on 'loop simd' constructs.Alexey Bataev2015-12-301-0/+7
| | | | | | OpenMP 4.5 allows to use 'ordered' clause without parameter on 'loop simd' constructs. llvm-svn: 256639
* Clean up this code, NFC.Richard Smith2015-12-301-8/+12
| | | | llvm-svn: 256607
* When a namespace alias redeclares a using declaration, point the diagnostic atRichard Smith2015-12-291-4/+4
| | | | | | the using declaration not at the thing it's using. llvm-svn: 256602
* Model NamespaceAliasDecls as having their nominated namespace as an underlyingRichard Smith2015-12-293-25/+24
| | | | | | | | | | | | | declaration. This fixes an issue where we would reject (due to a claimed ambiguity) a case where lookup finds multiple NamespaceAliasDecls from different scopes that nominate the same namespace. The C++ standard doesn't make it clear that such a case is in fact valid (which I'm working on fixing), but there are no relevant rules that distinguish using declarations and namespace alias declarations here, so it makes sense to treat them the same way. llvm-svn: 256601
OpenPOWER on IntegriCloud