summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Reapplying the changes from r158717 as they were rolled back to avoid merge ↵Aaron Ballman2012-06-191-29/+33
| | | | | | conflicts from a separate problematic patch. llvm-svn: 158750
* Revert r158700 and dependent patches r158716, r158717, and r158731.Jakob Stoklund Olesen2012-06-191-191/+187
| | | | | | | | The original r158700 caused crashes in the gcc test suite, g++.abi/vtable3a.C among others. It also caused failures in the libc++ test suite. llvm-svn: 158749
* Improves parsing and semantic analysis for MS __declspec attributes. This ↵Aaron Ballman2012-06-191-29/+33
| | | | | | includes support for the align (which fixes PR12631). llvm-svn: 158717
* Improve the specification of spellings in Attr.td.Alexis Hunt2012-06-191-166/+166
| | | | | | | | | | | | | | | | | Note that this is mostly a structural patch that handles the change from the old spelling style to the new one. One consequence of this is that all AT_foo_bar enum values have changed to not be based off of the first spelling, but rather off of the class name, so they are now AT_FooBar and the like (a straw poll on IRC showed support for this). Apologies for code churn. Most attributes have GNU spellings as a temporary solution until everything else is sorted out (such as a Keyword spelling, which I intend to add if someone else doesn't beat me to it). This is definitely a WIP. I've also killed BaseCheckAttr since it was unused, and I had to go through every attribute anyway. llvm-svn: 158700
* fix PR13071 / rdar://problem/11634669 :Nuno Lopes2012-06-181-0/+6
| | | | | | crash on invalid function decl with alloc_size attribute llvm-svn: 158663
* alloc_size attribute: there's nothing wrong with alloc_size(1,1). It just ↵Nuno Lopes2012-06-181-14/+2
| | | | | | means the function allocates x^2 bytes. GCC also accepts this syntax llvm-svn: 158662
* [MSExtensions] Add support for __forceinline.Michael J. Spencer2012-06-181-0/+10
| | | | | | __forceinline is a combination of the inline keyword and __attribute__((always_inline)) llvm-svn: 158653
* Still more Doxygen documentation fixes:James Dennett2012-06-141-2/+2
| | | | | | | | * Escape #, < and @ symbols where Doxygen would try to interpret them; * Fix several function param documentation where names had got out of sync; * Delete param documentation referring to parameters that no longer exist. llvm-svn: 158472
* Allow __attribute__((unused)) for fields and make it silenceDaniel Jasper2012-06-131-1/+1
| | | | | | -Wunused-private-field. llvm-svn: 158411
* Revert Decl's iterators back to pointer value_type rather than reference ↵David Blaikie2012-06-061-1/+1
| | | | | | | | | | | | | | value_type In addition, I've made the pointer and reference typedef 'void' rather than T* just so they can't get misused. I would've omitted them entirely but std::distance likes them to be there even if it doesn't use them. This rolls back r155808 and r155869. Review by Doug Gregor incorporating feedback from Chandler Carruth. llvm-svn: 158104
* Fix typos found by http://github.com/lyda/misspell-checkBenjamin Kramer2012-06-021-1/+1
| | | | llvm-svn: 157886
* objc: properties of NSObject attribute mustFariborz Jahanian2012-05-311-1/+9
| | | | | | | have correct pointer type or issue error, instead of crashing in IRGen. // rdar:// 11569860 llvm-svn: 157780
* -Wdeprecated warning to include reference (as a note)Fariborz Jahanian2012-05-271-1/+5
| | | | | | to the declaration in this patch. // rdar://10893232 llvm-svn: 157537
* implement Sema support for the alloc_size attributeNuno Lopes2012-05-241-0/+76
| | | | | | | | Portions of this patch by Xi Wang. Reviewed by Jordy Rose. Thank you both. Codegen support will follow soon. llvm-svn: 157360
* Recognize the MS inheritance attributes and turn them into attributesJohn McCall2012-05-221-1/+47
| | | | | | | | | on the RecordDecl. Persist the MS portability type attributes and ignore them in Sema rather than the parser. Patch by João Matos! llvm-svn: 157288
* StringSwitchify. No functionality change.Benjamin Kramer2012-05-161-20/+13
| | | | llvm-svn: 156916
* Factor sema for attributes unavailable and deprecated into a common function.Benjamin Kramer2012-05-161-28/+13
| | | | | | No functionality change. llvm-svn: 156914
* Refactor all theRafael Espindola2012-05-131-56/+47
| | | | | | | | | if (Inherited) Attr->setInherited(true); To a central location. llvm-svn: 156728
* Produce a warning for mismatched section attributes. Completest pr9356.Rafael Espindola2012-05-131-3/+17
| | | | llvm-svn: 156727
* Add support for __attribute__((hot)) and __attribute__((cold)).Benjamin Kramer2012-05-121-0/+42
| | | | | | | | Currently cold functions are marked with the "optsize" attribute in CodeGen so they are always optimized for size. The hot attribute is just ignored, LLVM doesn't have a way to express hotness at the moment. llvm-svn: 156723
* Remove unused variable. Thanks to Dmitri Gribenko for noticing it.Rafael Espindola2012-05-121-2/+0
| | | | llvm-svn: 156715
* Teach the parser to deal with multiple spellings for the sameDouglas Gregor2012-05-111-1/+0
| | | | | | | attribute, rather than requiring multiple cases in consumers of this information. llvm-svn: 156666
* Make sure that we recognize __attribute__((align)) as a synonym forDouglas Gregor2012-05-111-0/+1
| | | | | | | | __attribute__((aligned)). Fixes <rdar://problem/11435441>, a regression I introduced in r156003. This is the narrow fix; a more comprehensive fix is coming. llvm-svn: 156657
* Fix a recent regression with the merging of format attributes.Rafael Espindola2012-05-111-20/+27
| | | | llvm-svn: 156597
* Warn about visibility attributes in typedefs.Rafael Espindola2012-05-101-0/+4
| | | | llvm-svn: 156534
* Fix an old (2009) FIXME:Rafael Espindola2012-05-101-87/+111
| | | | | | | | | | | | | | | | | | | | | // FIXME: This needs to happen before we merge declarations. Then, // let attribute merging cope with attribute conflicts. This was already being done for variables, but for functions we were merging then first and then applying the attributes. To avoid duplicating merging logic, some of the helpers in SemaDeclAttr.cpp become methods that can handle merging two attributes in one decl or inheriting attributes from one decl to another. With this change we are now able to produce errors for variables with incompatible visibility attributes or warn about unused dllimports in variables. This changes the attribute list iteration back to being in reverse source code order, as that matches what decl merging does and avoids differentiating the two cases is the merge*Attr methods. llvm-svn: 156531
* Clean up SemaDeclAttr for high-warnings build.Jordy Rose2012-05-081-8/+8
| | | | | | Includes a real potential initialization problem. llvm-svn: 156363
* Add missing 'y'.Rafael Espindola2012-05-081-1/+1
| | | | llvm-svn: 156348
* Process attributes in the order they appear in the source code. This make clangRafael Espindola2012-05-071-1/+5
| | | | | | | | | | | | | | match gcc behavior for two conflicting visibilities in the same decl. It also makes handling of dllimport/dllexport more natural. As a bonus we now warn on the dllimport in void __attribute__((dllimport)) foo13(); void __attribute__((dllexport)) foo13(); as does gcc. llvm-svn: 156343
* Change how we suppress access control in explicit instantiationsJohn McCall2012-05-071-4/+12
| | | | | | | | | | so that we actually accumulate all the delayed diagnostics. Do this so that we can restore those diagnostics to good standing if it turns out that we were wrong to suppress, e.g. if the tag specifier is actually an elaborated type specifier and not a declaration. llvm-svn: 156291
* Refactor DelayedDiagnostics so that it keeps diagnostics inJohn McCall2012-05-071-61/+28
| | | | | | | separate pools owned by the RAII objects that keep pushing decl state. This gives us quite a bit more flexibility. llvm-svn: 156289
* Split mergeAvailabilityAttr out of handleAvailabilityAttr. This is importantRafael Espindola2012-05-061-40/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | for having a uniform logic for adding attributes to a decl. This in turn is needed to fix the FIXME: // FIXME: This needs to happen before we merge declarations. Then, // let attribute merging cope with attribute conflicts. ProcessDeclAttributes(S, NewFD, D, /*NonInheritable=*/false, /*Inheritable=*/true); The idea is that mergeAvailabilityAttr will become a method. Once attributes are processed before merging, it will be called from handleAvailabilityAttr to handle multiple attributes in one decl: void f(int) __attribute__((availability(ios,deprecated=3.0), availability(ios,introduced=2.0))); and from SemaDecl.cpp to handle multiple decls: void f(int) __attribute__((availability(ios,deprecated=3.0))); void f(int) __attribute__((availability(ios,introduced=2.0))); As a bonus, use the new structure to diagnose incompatible availability attributes added to different decls (see included testcases). llvm-svn: 156269
* Move Sema::VerifyIntegerConstantExpression() andDouglas Gregor2012-05-041-4/+4
| | | | | | | | Sema::ConvertToIntegralOrEnumerationType() from PartialDiagnostics to abstract "diagnoser" classes. Not much of a win here, but we're -several PartialDiagnostics. llvm-svn: 156217
* Thread safety analysis: check for LOCKABLE attribute on base classes.DeLesley Hutchins2012-05-041-4/+23
| | | | llvm-svn: 156175
* Thread safety analysis: additional support for smart pointers in lock ↵DeLesley Hutchins2012-05-021-16/+28
| | | | | | expressions. llvm-svn: 156030
* Walk the decls looking for the last one that has an attribute. We do have to ↵Rafael Espindola2012-05-021-6/+9
| | | | | | | | | | | | | | | | | | walk them, otherwise we cannot produce an error for both struct HIDDEN test4; // canonical struct test4; struct DEFAULT test4; and struct test5; // canonical struct HIDDEN test5; struct DEFAULT test5; llvm-svn: 156016
* Thread Safety Analysis: fixed attribute handling for lock_returned attribute.DeLesley Hutchins2012-05-021-2/+7
| | | | llvm-svn: 156005
* Extend the error about incompatible visibility attributes in differentRafael Espindola2012-05-011-1/+7
| | | | | | decls to work on function templates specializations. llvm-svn: 155943
* Remove the ref/value inconsistency in filter_decl_iterator.David Blaikie2012-04-301-1/+1
| | | | | | | | | | | | | filter_decl_iterator had a weird mismatch where both op* and op-> returned T* making it difficult to generalize this filtering behavior into a reusable library of any kind. This change errs on the side of value, making op-> return T* and op* return T&. (reviewed by Richard Smith) llvm-svn: 155808
* Reject cases likeRafael Espindola2012-04-261-0/+9
| | | | | | | | | struct __attribute__((visibility("hidden"))) a; struct __attribute__((visibility("default"))) b; which gcc already rejects. llvm-svn: 155603
* with -Wdeprecated, include a note to its deprecated declarationFariborz Jahanian2012-04-231-1/+5
| | | | | | location. // rdar://10893232 llvm-svn: 155385
* Thread safety analysis: support the use of pt_guarded_by attributesDeLesley Hutchins2012-04-231-0/+22
| | | | | | on smart pointers. Also adds test case for previous commit. llvm-svn: 155379
* Thread-safety analysis: support new "pointer to member" syntax forDeLesley Hutchins2012-04-231-1/+13
| | | | | | existentially quantified lock expressions. llvm-svn: 155357
* Remove unneeded code.Fariborz Jahanian2012-04-211-1/+1
| | | | llvm-svn: 155290
* objective-c arc: With currnt documentation, Fariborz Jahanian2012-04-201-2/+2
| | | | | | | | objc_returns_inner_pointer attribute can be applied to methods only. Diagnsose otherwise, instead of crashing. // rdar://11253688 llvm-svn: 155245
* Thread safety analysis: split warnings into two groups: attribute warningsDeLesley Hutchins2012-04-191-48/+46
| | | | | | | | | | which are checked in the parser, and analysis warnings that require the full analysis. This allows attribute syntax to be checked independently of the full thread safety analysis. Also introduces a new warning for the case where a string is used as a lock expression; this allows the analysis to gracefully handle expressions that would otherwise cause a parse error. llvm-svn: 155129
* Thread safety analysis: downgraded requirement that mutex expressions refer ↵DeLesley Hutchins2012-04-061-21/+17
| | | | | | to a lockable type from error to warning. llvm-svn: 154198
* Added a new attribute, objc_root_class, which informs the compiler when a ↵Patrick Beard2012-04-061-0/+19
| | | | | | | | | root class is intentionally declared. The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698> llvm-svn: 154187
* Minor cleanup in attribute-related diagnostics, from Alexander Kornienko!Douglas Gregor2012-03-141-14/+11
| | | | llvm-svn: 152725
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-4/+4
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
OpenPOWER on IntegriCloud