summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Refactor Clang sema attribute handling.Michael Han2012-03-071-7/+7
| | | | | | | | | | | | | | | | | This submission improves Clang sema handling by using Clang tablegen to generate common boilerplate code. As a start, it implements AttributeList enumerator generation and case statements for AttributeList::getKind. A new field "SemaHandler" is introduced in Attr.td and by default set to 1 as most of attributes in Attr.td have semantic checking in Sema. For a small number of attributes that don't appear in Sema, the value is set to 0. Also there are a small number of attributes that only appear in Sema but not in Attr.td. Currently these attributes are still hardcoded in Sema AttributeList. Reviewed by Delesley Hutchins. llvm-svn: 152169
* objc: When issue diagnostic about deprecated method, alsoFariborz Jahanian2012-03-021-1/+8
| | | | | | | issue the note if it is because message is sent to a forward class declaration in delayed diagnostic. // rdar://10290322 llvm-svn: 151942
* Fix regression from llvm-gcc where we should NOT emit a warning about ↵Ted Kremenek2012-03-011-1/+8
| | | | | | __attribute__((NSObject)) on a property declaration. This is needed to have retain properties for non-object pointers. Fixes <rdar://problem/10930507>. llvm-svn: 151786
* Turned on support for __declspecs: noreturn, noinline, nothrow and naked in ↵Aaron Ballman2012-02-231-4/+13
| | | | | | MS compatibility mode. llvm-svn: 151295
* Turned on support for __declspec(deprecated) in MS compatibility mode.Aaron Ballman2012-02-231-1/+2
| | | | llvm-svn: 151225
* Thread safety analysis: Don't check for lockable on undefined types.DeLesley Hutchins2012-02-161-0/+3
| | | | llvm-svn: 150702
* In C++11 mode, when an integral constant expression is desired and we have aRichard Smith2012-02-041-5/+6
| | | | | | | | | | | | | | | | | | value of class type, look for a unique conversion operator converting to integral or unscoped enumeration type and use that. Implements [expr.const]p5. Sema::VerifyIntegerConstantExpression now performs the conversion and returns the converted result. Some important callers of Expr::isIntegralConstantExpr have been switched over to using it (including all of those required for C++11 conformance); this switch brings a side-benefit of improved diagnostics and, in several cases, simpler code. However, some language extensions and attributes have not been moved across and will not perform implicit conversions on constant expressions of literal class type where an ICE is required. In passing, fix static_assert to perform a contextual conversion to bool on its argument. llvm-svn: 149776
* Split Sema::MarkDeclarationReferenced into multiple functions; the ↵Eli Friedman2012-02-021-1/+1
| | | | | | additional entry points are needed to implement C++11 odr-use marking correctly. No functional change in this patch; I'll actually make the change which fixes the odr-use marking in a followup patch. llvm-svn: 149586
OpenPOWER on IntegriCloud