summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Support tvOS and watchOS availability attributesTim Northover2015-10-301-0/+84
| | | | llvm-svn: 251711
* Refine r251469 to give better (and more localizable) diagnosticsJohn McCall2015-10-281-30/+63
| | | | | | for all the reasons that ARC makes things implicitly unavailable. llvm-svn: 251496
* Add the ability to define "fake" arguments on attributes.John McCall2015-10-281-2/+3
| | | | | | | | | | | | | | Fake arguments are automatically handled for serialization, cloning, and other representational tasks, but aren't included in pretty-printing or parsing (should we eventually ever automate that). This is chiefly useful for attributes that can be written by the user, but which are also frequently synthesized by the compiler, and which we'd like to remember details of the synthesis for. As a simple example, use this to narrow the cases in which we were generating a specialized note for implicitly unavailable declarations. llvm-svn: 251469
* Be more conservative about diagnosing "incorrect" uses of __weak:John McCall2015-10-271-9/+44
| | | | | | | | | | | | allow them to be written in certain kinds of user declaration and diagnose on the use-site instead. Also, improve and fix some diagnostics relating to __weak and properties. rdar://23228631 llvm-svn: 251384
* Amending r249721 to properly handle pathological attribute-related names ↵Aaron Ballman2015-10-091-2/+2
| | | | | | | | like __ and ____. Patch by Adrian Zgorzalek! llvm-svn: 249833
* When mapping no_sanitize_* attributes to no_sanitize attributes, handle ↵Aaron Ballman2015-10-081-11/+17
| | | | | | | | GNU-style formatting that involves prefix and suffix underscores. Cleans up other usages of similar functionality. Patch by Adrian Zgorzalek! llvm-svn: 249721
* Don't inherit availability information when implementing a protocol requirement.Douglas Gregor2015-09-301-15/+32
| | | | | | | | | | When an Objective-C method implements a protocol requirement, do not inherit any availability information from the protocol requirement. Rather, check that the implementation is not less available than the protocol requirement, as we do when overriding a method that has availability. Fixes rdar://problem/22734745. llvm-svn: 248949
* Thread Safety Analysis: allow capability attribute on unions.DeLesley Hutchins2015-09-291-7/+4
| | | | llvm-svn: 248805
* [CUDA] __global__ functions should always be visible externally.Artem Belevich2015-09-231-3/+0
| | | | | | | | | Adjust __global__ functions with DiscardableODR linkage to use StrongODR linkage instead, so they are visible externally. Differential Revision: http://reviews.llvm.org/D13067 llvm-svn: 248400
* [CUDA] Add implicit __attribute__((used)) to all __global__ functions.Artem Belevich2015-09-221-0/+4
| | | | | | | | | | This makes sure that we emit kernels that were instantiated from the host code and which would never be explicitly referenced by anything else on device side. Differential Revision: http://reviews.llvm.org/D11666 llvm-svn: 248293
* MS ABI: Don't allow dllexport/import on lambdasHans Wennborg2015-09-151-0/+8
| | | | | | | This is to follow up on David's comment in http://reviews.llvm.org/D12422#235509 llvm-svn: 247718
* Fix some coding standard issues and delete a dead conditional.Eric Christopher2015-08-131-6/+6
| | | | llvm-svn: 244959
* Revert "[CUDA] Add implicit __attribute__((used)) to all __global__ functions."Daniel Jasper2015-08-111-4/+0
| | | | | | This is breaking internal test. I'll provide a reproduction. llvm-svn: 244583
* [CUDA] Add implicit __attribute__((used)) to all __global__ functions.Artem Belevich2015-08-101-0/+4
| | | | | | | | | This allows emitting kernels that were instantiated from the host code and which would never be explicitly referenced otherwise. Differential Revision: http://reviews.llvm.org/D11666 llvm-svn: 244501
* [Sema] Refactor AddAlignedAttr to reduce indentationDavid Majnemer2015-07-261-19/+19
| | | | | | No functionality change intended, just a tidy-up. llvm-svn: 243242
* [Sema] The alignment of an object has an upper bound from the object file formatDavid Majnemer2015-07-261-2/+4
| | | | | | | Don't use the spelling of the alignment attribute to determine whether or not an alignment amount makes sense. llvm-svn: 243233
* [AST] Turn the callbacks of lookupInBases and forallBases into a function_refBenjamin Kramer2015-07-251-5/+4
| | | | | | | | | This lets us pass functors (and lambdas) without void * tricks. On the downside we can't pass CXXRecordDecl's Find* members (which are now type safe) to lookupInBases directly, but a lambda trampoline is a small price to pay. No functionality change intended. llvm-svn: 243217
* Ignore the "novtable" declspec when not using the Microsoft C++ ABI.Bob Wilson2015-07-201-1/+1
| | | | | | | | | | | | | | Clang used to silently ignore __declspec(novtable). It is implemented now, but leaving the vtable uninitialized does not work when using the Itanium ABI, where the class layout for complex class hierarchies is stored in the vtable. It might be possible to honor the novtable attribute in some simple cases and either report an error or ignore it in more complex situations, but it’s not clear if that would be worthwhile. There is also value in having a simple and predictable behavior, so this changes clang to simply ignore novtable when not using the Microsoft C++ ABI. llvm-svn: 242730
* [MS Compat] Add support for __declspec(noalias)David Majnemer2015-07-201-0/+3
| | | | | | | The attribute '__declspec(noalias)' communicates that the function only accesses memory pointed to by its pointer-typed arguments. llvm-svn: 242728
* Add a "maximum TLS alignment" characteristic to the target info, so itPaul Robinson2015-07-141-5/+21
| | | | | | | | | | can be different from the normal variable maximum. Add an error diagnostic for when TLS variables exceed maximum TLS alignment. Currenty only PS4 sets an explicit maximum TLS alignment. Patch by Charles Li! llvm-svn: 242198
* [ObjC] Add NSValue support for objc_boxed_expressionsAlex Denisov2015-06-261-0/+33
| | | | | | | | | | | | | Patch extends ObjCBoxedExpr to accept records (structs and unions): typedef struct __attribute__((objc_boxable)) _Color { int r, g, b; } Color; Color color; NSValue *boxedColor = @(color); // [NSValue valueWithBytes:&color objCType:@encode(Color)]; llvm-svn: 240761
* Allow the cf_returns_[not_]retained attributes to appear on out-parameters.Douglas Gregor2015-06-191-5/+43
| | | | | | | | | | | | | | | | Includes a simple static analyzer check and not much else, but we'll also be able to take advantage of this in Swift. This feature can be tested for using __has_feature(cf_returns_on_parameters). This commit also contains two fixes: - Look through non-typedef sugar when deciding whether something is a CF type. - When (cf|ns)_returns(_not)?_retained is applied to invalid properties, refer to "property" instead of "method" in the error message. rdar://problem/18742441 llvm-svn: 240185
* [ATTRIBUTE] Support base vector types of __attribute__((mode)), patch by ↵Alexey Bataev2015-06-191-10/+35
| | | | | | | | | | | | Alexey Frolov Base type of attribute((mode)) can actually be a vector type. The patch is to distinguish between base type and base element type. This fixes http://llvm.org/PR17453. Differential Revision: http://reviews.llvm.org/D10058 llvm-svn: 240125
* Add a warning for unsupported elements of the target attribute.Eric Christopher2015-06-121-3/+11
| | | | | | | | | Since we're ignoring the tune= and fpmath= attributes go ahead and add a warning alerting people to the fact that we're going to ignore that part of it during code generation and tie it to the attribute warning set. llvm-svn: 239583
* Add support for the the target attribute.Eric Christopher2015-06-121-0/+17
| | | | | | | | | | | | | | | Modeled after the gcc attribute of the same name, this feature allows source level annotations to correspond to backend code generation. In llvm particular parlance, this allows the adding of subtarget features and changing the cpu for a particular function based on source level hints. This has been added into the existing support for function level attributes without particular verification for any target outside of whether or not the backend will support the features/cpu given (similar to section, etc). llvm-svn: 239579
* Remove dead code.Richard Smith2015-05-281-2/+1
| | | | llvm-svn: 238526
* Use llvm::StringSwitch<std::string> to take advantage of implicit asserting ↵Peter Collingbourne2015-05-151-4/+2
| | | | | | conversion to std::string. llvm-svn: 237475
* Implement no_sanitize attribute.Peter Collingbourne2015-05-151-8/+44
| | | | | | Differential Revision: http://reviews.llvm.org/D9631 llvm-svn: 237463
* Don't warn about use of deprecated API when the containing context is ↵Jordan Rose2015-04-301-1/+1
| | | | | | | | | | unavailable. This probably won't come up much, but it seems tidier. Related to rdar://problem/20713550 llvm-svn: 236242
* [cuda] Allow using integral non-type template parameters as launch_bounds ↵Artem Belevich2015-04-211-10/+53
| | | | | | | | | | | | | | | | attribute arguments. - Changed CUDALaunchBounds arguments from integers to Expr* so they can be saved in AST for instantiation. - Added support for template instantiation of launch_bounds attrubute. - Moved evaluation of launch_bounds arguments to NVPTXTargetCodeGenInfo:: SetTargetAttributes() where it can be done after template instantiation. - Added a warning on negative launch_bounds arguments. - Amended test cases. Differential Revision: http://reviews.llvm.org/D8985 llvm-svn: 235452
* [Objective-C Sema] patch to introduce IndependentClassFariborz Jahanian2015-04-161-0/+19
| | | | | | | | | attribute to be placed on Objective-C pointer typedef to make them strong enough so on their "new" method family no attempt is made to override these types. rdar://20255473 llvm-svn: 235128
* [Sema] Don't crash when __attribute__((nonnull)) is applied to blocksDavid Majnemer2015-04-071-2/+7
| | | | | | | | | A simple case of asserting isFunctionOrMethod when we should have asserted isFunctionOrMethodOrBlock. This fixes PR23117. llvm-svn: 234297
* [Sema] Don't permit dependent alignments on non-dependent typedef-namesDavid Majnemer2015-04-071-0/+10
| | | | | | | | | | | | | | | | | A dependent alignment attribute (like __attribute__((aligned(...))) or __declspec(align(...))) on a non-dependent typedef or using declaration poses a considerable challenge: the type is _not_ dependent, the size _may_ be dependent if the type is used as an array type, the alignment _is_ dependent. It is reasonable for a compiler to be able to query the size and alignment of a complete type. Let's help that become an invariant. This fixes PR22042. Differential Revision: http://reviews.llvm.org/D8693 llvm-svn: 234280
* [Modules] Make "#pragma weak" undeclared identifiers be trackedChandler Carruth2015-03-261-2/+1
| | | | | | | | | | | | | | | | deterministically. This fixes a latent issue where even Clang's Sema (and diagnostics) were non-deterministic in the face of this pragma. The fix is super simple -- just use a MapVector so we track the order in which these are parsed (or imported). Especially considering how rare they are, this seems like the perfect tradeoff. I've also simplified the client code with judicious use of auto and range based for loops. I've added some pretty hilarious code to my stress test which now survives the binary diff without issue. llvm-svn: 233261
* Add -Wpartial-availability.Nico Weber2015-03-191-22/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | This warns when using decls that are not available on all deployment targets. For example, a call to - (void)ppartialMethod __attribute__((availability(macosx,introduced=10.8))); will warn if -mmacosx-version-min is set to less than 10.8. To silence the warning, one has to explicitly redeclare the method like so: @interface Whatever(MountainLionAPI) - (void)ppartialMethod; @end This way, one cannot accidentally call a function that isn't available everywhere. Having to add the redeclaration will hopefully remind the user to add an explicit respondsToSelector: call as well. Some projects build against old SDKs to get this effect, but building against old SDKs suppresses some bug fixes -- see http://crbug.com/463171 for examples. The hope is that SDK headers are annotated well enough with availability attributes that new SDK + this warning offers the same amount of protection as using an old SDK. llvm-svn: 232750
* Implement section pragma feedback on r205810Reid Kleckner2015-03-041-0/+12
| | | | | | | Mostly short-circuits some conditionals. Adds target validation of sections passed to these pragmas. llvm-svn: 231317
* Win64: Silently ignore __stdcall, __fastcall, and __thiscallReid Kleckner2015-02-261-2/+5
| | | | | | | | | | MSVC doesn't warn on this. Users are expected to apply the WINAPI macro to functions passed by pointer to the Win32 API, and this macro expands to __stdcall. This means we end up with a lot of useless noisy warnings about ignored calling conventions when compiling code with clang for Win64. llvm-svn: 230668
* Cleanup: remove artificial division between lookup results and const lookupRichard Smith2015-02-211-4/+4
| | | | | | | results. No-one was ever modifying a lookup result, and it would not be reasonable to do so. llvm-svn: 230123
* [Objective-C]. Provide a new formatting kind, "os_trace" whichFariborz Jahanian2015-02-211-0/+1
| | | | | | | can take a "const char*" format but supports standard printf and CF/NS types . rdar://19904147 llvm-svn: 230109
* Add support for analyzing FreeBSD kernel printf extensions.Dimitry Andric2015-02-191-0/+1
| | | | | | | | | | | | This adds a new __freebsd_kprintf__ format string type, which enables checking when used in __attribute__((format(...))) attributes. It can check the FreeBSD kernel specific %b, %D, %r and %y specifiers, using existing diagnostic messages. Also adds test cases for all these specifiers. Differential Revision: http://reviews.llvm.org/D7154 llvm-svn: 229921
* Sema: partially address post-commit commentsSaleem Abdulrasool2015-02-181-2/+1
| | | | | | | Un-parameterize the warning as there is exactly one attribute added in C++14. Partially addresses post-commit review comments from Richard Smith. llvm-svn: 229636
* Minor tweaks to r229447 to ensure the attribute is properly quoted when ↵Aaron Ballman2015-02-161-1/+1
| | | | | | diagnosed. llvm-svn: 229454
* Sema: diagnose use of unscoped deprecated prior to C++14Saleem Abdulrasool2015-02-161-0/+7
| | | | | | | | | The deprecated attribute was adopted as part of the C++14, however, there is a GNU version available in C++11. When using C++ earlier than C++14, diagnose the use of the attribute without the GNU scope, but only when using the generalised attribute syntax. llvm-svn: 229447
* Sema: Add support for __declspec(restrict)David Majnemer2015-02-041-12/+10
| | | | | | | | | | __declspec(restrict) and __attribute(malloc) are both handled identically by clang: they are allowed to the noalias LLVM attribute. Seeing as how noalias models the C99 notion of 'restrict', rename the internal clang attribute to Restrict from Malloc. llvm-svn: 228120
* The prefix 'Ms-' should be 'MS-'David Majnemer2015-02-021-4/+4
| | | | | | | Clang is otherwise consistent that Microsoft be abbreviated as MS, not Ms. llvm-svn: 227842
* MS ABI: Implement support for 'novtable'David Majnemer2015-02-021-0/+3
| | | | | | | | | | It is common for COM interface classes to be marked as 'novtable' to tell the compiler that constructors and destructors should not reference virtual function tables. This commit implements this feature in clang. llvm-svn: 227796
* Allow objc_bridge(id) to be used on typedefs of [cv] void*.John McCall2015-02-011-0/+16
| | | | | | rdar://19678874 llvm-svn: 227774
* Remove support for pnaclcall attributeDerek Schuff2015-01-281-7/+0
| | | | | | | | | | | | | | | | | | Summary: It was used for interoperability with PNaCl's calling conventions, but it's no longer needed. Also Remove NaCl*ABIInfo which just existed to delegate to either the portable or native ABIInfo, and remove checkCallingConvention which was now a no-op override. Reviewers: jvoung Subscribers: jfb, llvm-commits Differential Revision: http://reviews.llvm.org/D7206 llvm-svn: 227362
* AST: Don't ignore alignas on EnumDecls when calculating alignmentDavid Majnemer2015-01-211-8/+11
| | | | | | | | | | | | | | | | | | | | | | We didn't consider any alignment attributes on an EnumDecl when calculating alignment. While we are here, ignore alignment specifications on typedef types if one is used as the underlying type. Otherwise, weird things happen: enum Y : int; Y y; typedef int __attribute__((aligned(64))) u; enum Y : u {}; What is the alignment of 'Y'? It would be more consistent with the overall design of enums with fixed underlying types to consider the underlying type's UnqualifiedDesugaredType. This fixes PR22279. llvm-svn: 226653
* Fix crashes on missing @interface for categoryBen Langmuir2015-01-201-2/+8
| | | | | | | In a few places we didn't check that Category->getClassInterface() was not null before using it. llvm-svn: 226605
OpenPOWER on IntegriCloud