summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclAttr.cpp
Commit message (Collapse)AuthorAge
* MS ABI: Ignore dll attributes on partial template specializationsHans Wennborg2014-06-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211648 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge handleDLLImportAttr and handleDLLExportAttr into one function.Hans Wennborg2014-06-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211647 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Diagnose when property access is using declaredFariborz Jahanian2014-06-16
| | | | | | | | property accessor methods which have become deprecated or available. // rdar://15951801 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211039 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Use isObjCRetainableType in my lastFariborz Jahanian2014-06-12
| | | | | | | patch. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210795 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Accept '__attribute__((__ns_returns_retained__))' Fariborz Jahanian2014-06-11
| | | | | | | | for function/methods returning block in MRR mode as well. // rdar://17259812 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210706 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-29
| | | | | | takeAs to getAs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209800 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209613 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't suppress warning about dllimport on typedefs etc. in MicrosoftExt modeHans Wennborg2014-05-23
| | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209546 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the flatten attribute.Peter Collingbourne2014-05-20
| | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209217 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the no_split_stack attribute.Peter Collingbourne2014-05-19
| | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209167 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Reject reqd_work_group_size(X, Y, Z) where X, Y or Z == 0.Joey Gouly2014-05-19
| | | | | | | Patch by Pedro Ferreira! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209127 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow dllimport/dllexport on inline functions and adjust the linkage.Hans Wennborg2014-05-15
| | | | | | | | This is a step towards handling these attributes on classes (PR11170). Differential Revision: http://reviews.llvm.org/D3772 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208925 91177308-0d34-0410-b5e6-96231b3b80d8
* Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.Benjamin Kramer2014-05-10
| | | | | | | Required pulling LambdaExpr::Capture into its own header. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208470 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for __declspec(thread) under -fms-extensionsReid Kleckner2014-05-01
| | | | | | | | Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D3551 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207734 91177308-0d34-0410-b5e6-96231b3b80d8
* In preparation for being able to use simple Boolean logic expressions ↵Aaron Ballman2014-04-04
| | | | | | involving capabilities, the semantics for attributes now looks through the types of the constituent parts of a capability expression instead of at the aggregate expression type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205629 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the 'optnone' attribute, which suppresses most optimizationsPaul Robinson2014-03-31
| | | | | | | on a function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205255 91177308-0d34-0410-b5e6-96231b3b80d8
* Capability attributes can now be declared on a typedef declaration as well ↵Aaron Ballman2014-03-24
| | | | | | as a structure declaration. This allows for C code to use Boolean expressions on a capability as part of another attribute. Eg) __attribute__((requires_capability(!SomeCapability))) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204657 91177308-0d34-0410-b5e6-96231b3b80d8
* Replacing the exclusive_lock_function, shared_lock_function and ↵Aaron Ballman2014-03-20
| | | | | | | | unlock_function attributes with the acquire_capability and release_capability attributes. The old spellings will continue to work, but the underlying semantic attributes have been replaced. Downgraded the capability diagnostics from error to warning to match the desired behavior, and updated the existing test cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204350 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing FunctionProtoType iterators param_type_begin() and ↵Aaron Ballman2014-03-17
| | | | | | param_type_end() with iterator_range param_types(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204045 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Allow objc_designated_initializer for private Fariborz Jahanian2014-03-14
| | | | | | | | initializers; but only those declared in class extensions (not in implementations). // rdar://16305347 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203954 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing DeclBase iterators specific_attr_begin() and ↵Aaron Ballman2014-03-10
| | | | | | specific_attr_end() with iterator_range specific_attrs(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203474 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Fix assertion hit with #pragma weak.Argyrios Kyrtzidis2014-03-09
| | | | | | rdar://16264844 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203372 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing RecordDecl iterators field_begin() and field_end() with ↵Aaron Ballman2014-03-08
| | | | | | iterator_range fields(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203355 91177308-0d34-0410-b5e6-96231b3b80d8
* Reformatting the style used within the massive attribute semantic handling ↵Aaron Ballman2014-03-06
| | | | | | | | switch statement, so now there is only one style used in this block of code, instead of three or more styles. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203120 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove 2 dead 'break' statements. The 'break' usage in this switch is ↵Ted Kremenek2014-03-06
| | | | | | inconsistent, making this hard to see. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203079 91177308-0d34-0410-b5e6-96231b3b80d8
* Capabilities are required to pass a name specifying what type of capability ↵Aaron Ballman2014-03-05
| | | | | | | | is being annotated. There are currently only two supported names: mutex and role. Adding functionality to check for the capability name and diagnose when it's unexpected. Note that for backwards compatibility, an unnamed capability will default to being a "mutex." This allows the deprecated lockable attribute to continue to function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203012 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Definition of dllimport globals is not allowedNico Rieck2014-02-26
| | | | | | | Upgrades the warning to an error and clarifies the message by treating the definition as error instead of the attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202300 91177308-0d34-0410-b5e6-96231b3b80d8
* Attr: Remove ForceInlineDavid Majnemer2014-02-25
| | | | | | | | | | | The __forceinline keyword's semantics are now recast as AlwaysInline and the kw___forceinline token has its language mode set for KEYMS. This preserves the semantics of the previous implementation but with less duplication of code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202131 91177308-0d34-0410-b5e6-96231b3b80d8
* Reorganize and improve semantic tests for dllexport/importNico Rieck2014-02-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201947 91177308-0d34-0410-b5e6-96231b3b80d8
* Exposing the noduplicate attribute within Clang, which marks functions so ↵Aaron Ballman2014-02-22
| | | | | | | | that the optimizer does not duplicate code. Patch thanks to Marcello Maggioni! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201941 91177308-0d34-0410-b5e6-96231b3b80d8
* Per feedback from Aaron Ballman, push cast-to-ObjCProtocolDecl inside ↵Ted Kremenek2014-02-22
| | | | | | handleObjCSuppresProtocolAttr(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201922 91177308-0d34-0410-b5e6-96231b3b80d8
* Add requirement that attribute ↵Ted Kremenek2014-02-21
| | | | | | 'objc_protocol_requires_explicit_implementation' can only be applied to protocol definitions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201899 91177308-0d34-0410-b5e6-96231b3b80d8
* Adding role-based capability attributes that allow you to express role ↵Aaron Ballman2014-02-21
| | | | | | | | management: asserting a capability is held, acquiring a capability and releasing a capability. Also includes some skeleton documentation for these new attributes. This functionality should be considered a WIP. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201890 91177308-0d34-0410-b5e6-96231b3b80d8
* DeLesley Hutchins (who wrote the original thread-safety attribute ↵Aaron Ballman2014-02-18
| | | | | | | | | | | | | | | functionality) and I have agreed to start migrating from lock-specific terminology to "capability"-specific terminology. This opens the door for future threading-related analysis passes so that a common nomenclature can be used. The following attributes have been (silently) deprecated, with their replacements listed: lockable => capability exclusive_locks_required => requires_capability shared_locks_required => requires_shared_capability locks_excluded => requires_capability There are no functional changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201585 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Restrict alignment to 2**28.David Majnemer2014-02-12
| | | | | | | | | Allowing alignment past this point causes wrap around within clang. N.B. GCC has the same restriction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201254 91177308-0d34-0410-b5e6-96231b3b80d8
* 'nonnull(1)' on a block parameter should apply to the block's argument.Jordan Rose2014-02-11
| | | | | | | | | | | | | | | Thanks to r199467, __attribute__((nonnull)) (without arguments) can apply directly to parameters, instead of being applied to the whole function. However, the old form of nonnull (with an argument index) could also apply to the arguments of function and block pointers, and both of these can be passed as parameters. Now, if 'nonnull' with an argument is found on a parameter, /and/ the parameter is a function or block pointer, it is handled the old way. PR18795 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201162 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Add support for #pragma pointers_to_membersDavid Majnemer2014-02-10
| | | | | | | | | | | | | | | | | | | | Introduce a notion of a 'current representation method' for pointers-to-members. When starting out, this is set to 'best case' (representation method is chosen by examining the class, selecting the smallest representation that would work given the class definition or lack thereof). This pragma allows the translation unit to dictate exactly what representation to use, similar to how the inheritance model keywords operate. N.B. PCH support is forthcoming. Differential Revision: http://llvm-reviews.chandlerc.com/D2723 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201105 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Don't be so hasty to judge an inheritance modelDavid Majnemer2014-02-07
| | | | | | | | | If we are in the middle of defining the class, don't attempt to validate previously annotated declarations. We may not have seen base specifiers or virtual method declarations yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200959 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Diagnose improper application of inheritance keywordsDavid Majnemer2014-01-29
| | | | | | | | | | | | We would previously allow inappropriate inheritance keywords to appear on class declarations. We would also allow inheritance keywords on templates which were not fully specialized; this was divergent from MSVC. Differential Revision: http://llvm-reviews.chandlerc.com/D2585 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200423 91177308-0d34-0410-b5e6-96231b3b80d8
* Relaxing the alignment requirements for fields in a transparent_union. Emits ↵Aaron Ballman2014-01-28
| | | | | | | | the diagnostic only when subsequent alignments are more strict than the alignment required by the first field. Fixes PR15134 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200277 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename getResultLoc() tooAlp Toker2014-01-25
| | | | | | | | Follow up to r200082. Spotted by Dmitri git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200105 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-25
| | | | | | | | | | | | | | | A return type is the declared or deduced part of the function type specified in the declaration. A result type is the (potentially adjusted) type of the value of an expression that calls the function. Rule of thumb: * Declarations have return types and parameters. * Expressions have result types and arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200082 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct various uses of 'argument' that in fact refer to function parametersAlp Toker2014-01-21
| | | | | | Cleanup only. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199773 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename FunctionProtoType accessors from 'arguments' to 'parameters'Alp Toker2014-01-20
| | | | | | | | | | | | | | | | | Fix a perennial source of confusion in the clang type system: Declarations and function prototypes have parameters to which arguments are supplied, so calling these 'arguments' was a stretch even in C mode, let alone C++ where default arguments, templates and overloading make the distinction important to get right. Readability win across the board, especially in the casting, ADL and overloading implementations which make a lot more sense at a glance now. Will keep an eye on the builders and update dependent projects shortly. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199686 91177308-0d34-0410-b5e6-96231b3b80d8
* Formatting cleanups; no functional changes.Aaron Ballman2014-01-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199671 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing a typo (turned out to be harmless since the default priority values ↵Aaron Ballman2014-01-20
| | | | | | are the same between the two attributes). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199666 91177308-0d34-0410-b5e6-96231b3b80d8
* Since the diagnostics engine understands Attr objects, this code is no ↵Aaron Ballman2014-01-20
| | | | | | longer required -- we can just pass in the attribute directly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199664 91177308-0d34-0410-b5e6-96231b3b80d8
* Making some minor improvements to r199626.Aaron Ballman2014-01-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199663 91177308-0d34-0410-b5e6-96231b3b80d8
* Wire up basic parser/sema support for attribute 'returns_nonnull'.Ted Kremenek2014-01-20
| | | | | | | | | | | This attribute is supported by GCC. More generally it should probably be a type attribute, but this behavior matches 'nonnull'. This patch does not include warning logic for checking if a null value is returned from a function annotated with this attribute. That will come in subsequent patches. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199626 91177308-0d34-0410-b5e6-96231b3b80d8
* These attributes are no longer "checker-specific."Ted Kremenek2014-01-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199625 91177308-0d34-0410-b5e6-96231b3b80d8