summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Wrap to 80 columns. No behavior change.Nico Weber2015-01-071-29/+20
| | | | llvm-svn: 225414
* Attributes accepting an EnumArgument are allowed to pass a string literal, ↵Aaron Ballman2014-12-191-2/+8
| | | | | | | | or an identifier. VariadicEnumArguments now behave consistently instead of only accepting a string literal. This change affects the only attribute accepting a variadic enumeration: callable_when. llvm-svn: 224582
* Warn when attribute 'optnone' conflicts with attributes on aPaul Robinson2014-12-151-0/+49
| | | | | | different declaration of the same function. llvm-svn: 224256
* Sema: attribute((annotate)) must have at least one argumentDavid Majnemer2014-12-141-1/+1
| | | | | | | | | | Sema::handleAnnotateAttr expects that some basic validation is done on the given AttributeList. However, ProcessAccessDeclAttributeList called it directly. Instead, pass the list to ProcessDeclAttribute. This fixes PR21847. llvm-svn: 224204
* Diagnose attributes 'optnone' and 'minsize' on the same declaration.Paul Robinson2014-12-101-1/+13
| | | | | | | Eventually we'll diagnose them on different declarations, but let's get this part out of the way first. llvm-svn: 223985
* Revert r223980 as it had wrong commit message.Paul Robinson2014-12-101-13/+1
| | | | llvm-svn: 223984
* Rename a couple of preprocessor symbols to be more descriptive. NFC.Paul Robinson2014-12-101-1/+13
| | | | | | Review feedback from recent changes to GetSVN.cmake. llvm-svn: 223980
* Workaround attribute ordering issue with kernel only attributesMatt Arsenault2014-12-051-0/+10
| | | | | | | | | | | Placing the attribute after the kernel keyword would incorrectly reject the attribute, so use the smae workaround that other kernel only attributes use. Also add a FIXME because there are two different phrasings now for the same error, althoug amdgpu_num_[sv]gpr uses a consistent one. llvm-svn: 223490
* Use else if when checking multiple attributes.Matt Arsenault2014-12-051-4/+2
| | | | | | Only one of these can really match. llvm-svn: 223489
* Adding a FIXME to the code, based on a discussion in IRC; NFC.Aaron Ballman2014-12-041-0/+4
| | | | llvm-svn: 223403
* Add attributes for AMDGPU register limits.Matt Arsenault2014-12-041-0/+32
| | | | | | | This is a performance hint that can be applied to kernels to attempt to limit the number of used registers. llvm-svn: 223384
* Create a new 'flag_enum' attribute.Alexis Hunt2014-11-281-0/+3
| | | | | | | | | | | This attribute serves as a hint to improve warnings about the ranges of enumerators used as flag types. It currently has no working C++ implementation due to different semantics for enums in C++. For more explanation, see the docs and testcases. Reviewed by Aaron Ballman. llvm-svn: 222906
* [c++1z] Support [[deprecated]] attributes on namespaces. Note that it only ↵Aaron Ballman2014-11-141-5/+17
| | | | | | applies to situations where the namespace is mentioned. Thus, use on anonymous namespaces is diagnosed. llvm-svn: 222054
* Don't dllimport inline functions when targeting MinGW (PR21366)Hans Wennborg2014-11-031-0/+10
| | | | | | | | | | | | It turns out that MinGW never dllimports of exports inline functions. This means that code compiled with Clang would fail to link with MinGW-compiled libraries since we might try to import functions that are not imported. To fix this, make Clang never dllimport inline functions when targeting MinGW. llvm-svn: 221154
* Add frontend support for __vectorcallReid Kleckner2014-10-241-0/+7
| | | | | | | | | | | | | Wire it through everywhere we have support for fastcall, essentially. This allows us to parse the MSVC "14" CTP headers, but we will miscompile them because LLVM doesn't support __vectorcall yet. Reviewed By: Aaron Ballman Differential Revision: http://reviews.llvm.org/D5808 llvm-svn: 220573
* Turned Sema::HandleDelayedAvailabilityCheck into a static function; NFC.Aaron Ballman2014-10-151-100/+92
| | | | | | Did a bit of drive-by reformatting as well since it required rearranging some other static functions in the file. llvm-svn: 219795
* Initial support for the align_value attributeHal Finkel2014-10-021-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for the align_value attribute. This attribute is supported by Intel's compiler (versions 14.0+), and several of my HPC users have requested support in Clang. It specifies an alignment assumption on the values to which a pointer points, and is used by numerical libraries to encourage efficient generation of vector code. Of course, we already have an aligned attribute that can specify enhanced alignment for a type, so why is this additional attribute important? The problem is that if you want to specify that an input array of T is, say, 64-byte aligned, you could try this: typedef double aligned_double attribute((aligned(64))); void foo(aligned_double *P) { double x = P[0]; // This is fine. double y = P[1]; // What alignment did those doubles have again? } the access here to P[1] causes problems. P was specified as a pointer to type aligned_double, and any object of type aligned_double must be 64-byte aligned. But if P[0] is 64-byte aligned, then P[1] cannot be, and this access causes undefined behavior. Getting round this problem requires a lot of awkward casting and hand-unrolling of loops, all of which is bad. With the align_value attribute, we can accomplish what we'd like in a well defined way: typedef double *aligned_double_ptr attribute((align_value(64))); void foo(aligned_double_ptr P) { double x = P[0]; // This is fine. double y = P[1]; // This is fine too. } This attribute does not create a new type (and so it not part of the type system), and so will only "propagate" through templates, auto, etc. by optimizer deduction after inlining. This seems consistent with Intel's implementation (thanks to Alexey for confirming the various Intel-compiler behaviors). As a final note, I would have chosen to call this aligned_value, not align_value, for better naming consistency with the aligned attribute, but I think it would be more useful to users to adopt Intel's name. llvm-svn: 218910
* Support the assume_aligned function attributeHal Finkel2014-09-261-8/+76
| | | | | | | | | In addition to __builtin_assume_aligned, GCC also supports an assume_aligned attribute which specifies the alignment (and optional offset) of a function's return value. Here we implement support for the assume_aligned attribute by making use of the @llvm.assume intrinsic. llvm-svn: 218500
* Add __builtin_assume and __builtin_assume_aligned using @llvm.assume.Hal Finkel2014-09-071-1/+1
| | | | | | | | | | | This makes use of the recently-added @llvm.assume intrinsic to implement a __builtin_assume(bool) intrinsic (to provide additional information to the optimizer). This hooks up __assume in MS-compatibility mode to mirror __builtin_assume (the semantics have been intentionally kept compatible), and implements GCC's __builtin_assume_aligned as assume((p - o) & mask == 0). LLVM now contains special logic to deal with assumptions of this form. llvm-svn: 217349
* Fix up formatting.Eli Bendersky2014-09-021-1/+1
| | | | llvm-svn: 216976
* Fix representation of __attribute__((nonnull)) to support correctly modelingRichard Smith2014-08-271-33/+34
| | | | | | | | | | | | | | | the no-arguments case. Don't expand this to an __attribute__((nonnull(A, B, C))) attribute, since that does the wrong thing for function templates and varargs functions. In passing, fix a grammar error in the diagnostic, a crash if __attribute__((nonnull(N))) is applied to a varargs function, a bug where the same null argument could be diagnosed multiple times if there were multiple nonnull attributes referring to it, and a bug where nonnull attributes would not be accumulated correctly across redeclarations. llvm-svn: 216520
* Highlight the offending function parameter when the format argument refers ↵Aaron Ballman2014-08-041-5/+6
| | | | | | to an invalid function parameter type. llvm-svn: 214723
* Highlight the offending function parameter when the format_arg argument ↵Aaron Ballman2014-08-041-6/+4
| | | | | | refers to an invalid function parameter type. llvm-svn: 214722
* Dropping some else-after-returns. No functional changes intended.Aaron Ballman2014-08-011-7/+7
| | | | llvm-svn: 214526
* Improving diagnostic source ranges for the nonnull attribute. Now it ↵Aaron Ballman2014-08-011-9/+31
| | | | | | highlights the attribute and the faulty nonpointer type when possible. llvm-svn: 214507
* Implemented a diagnostic to handle multiple, distinct ownership_return ↵Aaron Ballman2014-07-311-2/+15
| | | | | | attributes on the same declaration. This removes a FIXME from the code. llvm-svn: 214436
* Removing an outdated FIXME. No functional changes.Aaron Ballman2014-07-311-4/+0
| | | | llvm-svn: 214411
* Automate attribute argument count semantic checking when there are variadic ↵Aaron Ballman2014-07-311-67/+43
| | | | | | | | or optional arguments present. With this, the only time you should have to manually check attribute argument counts is when HasCustomParsing is set to true, or when you have variadic arguments that aren't really variadic (like ownership_holds and friends). Updating the diagnostics in the launch_bounds test since they have been improved in that case. Adding a test for nonnull since it has little test coverage, but has truly variadic arguments. llvm-svn: 214407
* Improving the "integer constant too large" diagnostics based on post-commit ↵Aaron Ballman2014-07-241-1/+2
| | | | | | feedback from Richard Smith. Amends r213657. llvm-svn: 213865
* Improve the checkUInt32Argument() helper function so that it diagnoses ↵Aaron Ballman2014-07-221-0/+6
| | | | | | integer constants larger than 32-bits. llvm-svn: 213658
* Objective-C. Changes per A. Ballman's commentFariborz Jahanian2014-07-161-6/+7
| | | | | | for my last patch. // rdar://17631257 llvm-svn: 213185
* Objective-C. Introducing __attribute__((objc_runtime_name("runtimename"))Fariborz Jahanian2014-07-161-0/+14
| | | | | | | | | to be applied to class or protocols. This will direct IRGen for Objective-C metadata to use the new name in various places where class and protocol names are needed. rdar:// 17631257 llvm-svn: 213167
* Fix typosAlp Toker2014-07-141-1/+1
| | | | | | Also consolidate 'backward compatibility' llvm-svn: 212974
* The returns_nonnull attribute does not require a function prototype because ↵Aaron Ballman2014-07-111-1/+1
| | | | | | it affects only the return value, not any arguments. In turn, asking for a function or method result type should not require a function prototype either, so getFunctionOrMethodResultType has been relaxed. llvm-svn: 212827
* Switch over a few uses of param_begin() to parameters()Alp Toker2014-07-071-1/+1
| | | | llvm-svn: 212442
* Make FunctionDecl::getReturnTypeSourceRange() support non-builtin typesAlp Toker2014-07-021-9/+4
| | | | | | | Also document that the function is a "best-effort" facility to extract source ranges from limited AST type location info. llvm-svn: 212174
* MS ABI: Ignore dll attributes on partial template specializationsHans Wennborg2014-06-241-0/+7
| | | | llvm-svn: 211648
* Merge handleDLLImportAttr and handleDLLExportAttr into one function.Hans Wennborg2014-06-241-13/+6
| | | | llvm-svn: 211647
* Objective-C. Diagnose when property access is using declaredFariborz Jahanian2014-06-161-7/+12
| | | | | | | property accessor methods which have become deprecated or available. // rdar://15951801 llvm-svn: 211039
* Objective-C. Use isObjCRetainableType in my lastFariborz Jahanian2014-06-121-5/+3
| | | | | | patch. NFC. llvm-svn: 210795
* Objective-C. Accept '__attribute__((__ns_returns_retained__))' Fariborz Jahanian2014-06-111-1/+12
| | | | | | | for function/methods returning block in MRR mode as well. // rdar://17259812 llvm-svn: 210706
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-2/+2
| | | | | | takeAs to getAs. llvm-svn: 209800
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-261-39/+39
| | | | llvm-svn: 209613
* Don't suppress warning about dllimport on typedefs etc. in MicrosoftExt modeHans Wennborg2014-05-231-12/+0
| | | | | | | | | | | | | | | | | It's true the MSVC doesn't warn about dllimport when applied to e.g. a typedef, but that applies to dllexport too. I'd like us to be consistent, and I think the right thing to do is to warn. The original test that came with implementing the old behaviour doesn't provide a good motivation, and it said it was checking that we're not repoting an *error*, which is still true since this is just a warning. There are plenty of tests e.g. in Sema/dllimport.c to check that we do warn about dllimport on non functions or variables. Differential Revision: http://reviews.llvm.org/D3832 llvm-svn: 209546
* Implement the flatten attribute.Peter Collingbourne2014-05-201-0/+3
| | | | | | | | | | This is a GNU attribute that causes calls within the attributed function to be inlined where possible. It is implemented by giving such calls the alwaysinline attribute. Differential Revision: http://reviews.llvm.org/D3816 llvm-svn: 209217
* Implement the no_split_stack attribute.Peter Collingbourne2014-05-191-0/+3
| | | | | | | | | This is a GNU attribute that allows split stacks to be turned off on a per-function basis. Differential Revision: http://reviews.llvm.org/D3817 llvm-svn: 209167
* [OpenCL] Reject reqd_work_group_size(X, Y, Z) where X, Y or Z == 0.Joey Gouly2014-05-191-2/+9
| | | | | | Patch by Pedro Ferreira! llvm-svn: 209127
* Allow dllimport/dllexport on inline functions and adjust the linkage.Hans Wennborg2014-05-151-15/+0
| | | | | | | | This is a step towards handling these attributes on classes (PR11170). Differential Revision: http://reviews.llvm.org/D3772 llvm-svn: 208925
* Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.Benjamin Kramer2014-05-101-0/+1
| | | | | | | Required pulling LambdaExpr::Capture into its own header. No functionality change. llvm-svn: 208470
* Add support for __declspec(thread) under -fms-extensionsReid Kleckner2014-05-011-0/+22
| | | | | | | | Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D3551 llvm-svn: 207734
OpenPOWER on IntegriCloud