summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* warn when attribute warn_unused_result is applied to void functions.Nuno Lopes2009-12-221-1/+6
| | | | | | while at it, remove an outdated FIXME llvm-svn: 91946
* fix PR4010: add support for the warn_unused_result for function pointersNuno Lopes2009-12-201-4/+3
| | | | llvm-svn: 91803
* This patch should fix PR2461. It allows clang to apply the noreturnMike Stump2009-12-151-1/+2
| | | | | | | | | attribute to function pointers. It also fixes Sema to check function pointers for the noreturn attribute when checking for fallthrough. Patch by Chip Davis, with a slight fix to pass the testsuite. llvm-svn: 91408
* Add support for the cleanup attribute for C++; we don't have to copyMike Stump2009-12-091-4/+0
| | | | | | all of g++'s bugs. llvm-svn: 90924
* DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated ↵John McCall2009-12-071-4/+4
| | | | | | | | | | | | | | | | | | | | | variables, but the results are imperfect. For posterity, I did: cat <<EOF > $cmdfile s/DeclaratorInfo/TypeSourceInfo/g s/DInfo/TInfo/g s/TypeTypeSourceInfo/TypeSourceInfo/g s/SourceTypeSourceInfo/TypeSourceInfo/g EOF find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \; find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \; find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \; llvm-svn: 90743
* Fix for PR5650 - Revised vector_size attribute handling to be done earlier ↵John Thompson2009-12-041-86/+1
| | | | | | before declaration is finalized. llvm-svn: 90600
* Use StringRef in Attr constructors.Benjamin Kramer2009-11-301-10/+4
| | | | llvm-svn: 90140
* Parse C++ member check attributes - base_check, hiding, and override.Alexis Hunt2009-11-251-43/+125
| | | | | | The attributes are currently ignored. llvm-svn: 89837
* Rip out TemplateIdRefExpr and make UnresolvedLookupExpr and John McCall2009-11-241-3/+4
| | | | | | | | | | | | DependentScopeDeclRefExpr support storing templateids. Unite the common code paths between ActOnDeclarationNameExpr and ActOnTemplateIdExpr. This gets us to a point where we don't need to store function templates in the AST using TemplateNames, which is critical to ripping out OverloadedFunction. Also resolves a few FIXMEs. llvm-svn: 89785
* Added rudimentary C++0x attribute support.Alexis Hunt2009-11-211-3/+45
| | | | | | | | | | | | | | The following attributes are currently supported in C++0x attribute lists (and in GNU ones as well): - align() - semantics believed to be conformant to n3000, except for redeclarations and what entities it may apply to - final - semantics believed to be conformant to CWG issue 817's proposed wording, except for redeclarations - noreturn - semantics believed to be conformant to n3000, except for redeclarations - carries_dependency - currently ignored (this is an optimization hint) llvm-svn: 89543
* Start support of weak_import objective-c classes.Fariborz Jahanian2009-11-171-1/+1
| | | | | | (Radar 6815425). llvm-svn: 89124
* Adjust format attribute index for implicit object arguments. Fixes PR5521.Sebastian Redl2009-11-171-1/+8
| | | | llvm-svn: 89113
* Add support for cdecl attribute. (As far as I know, it doesn't affect CodeGenEli Friedman2009-11-091-0/+33
| | | | | | | | unless we start implementing command-line switches which override the default calling convention, so the effect is mostly to silence unknown attribute warnings.) llvm-svn: 86571
* Diagnose the use of 'fastcall' on functions without prototypes or withJohn McCall2009-11-041-0/+18
| | | | | | varargs prototypes. llvm-svn: 86001
* Change our basic strategy for avoiding deprecation warnings when the decl useJohn McCall2009-11-041-0/+59
| | | | | | | | | | | | appears in a deprecated context. In the new strategy, we emit the warnings as usual unless we're currently parsing a declaration, where "declaration" is restricted to mean a decl group or a few special cases in Objective C. If we *are* parsing a declaration, we queue up the deprecation warnings until the declaration has been completely parsed, and then emit them only if the decl is not deprecated. We also standardize the bookkeeping for deprecation so as to avoid special cases. llvm-svn: 85998
* Rename FunctionDecl::isInline/setInline toDouglas Gregor2009-10-271-3/+3
| | | | | | FunctionDecl::isInlineSpecified/setInlineSpecified. llvm-svn: 85305
* Preserve type source information in TypedefDecls. Preserve it acrossJohn McCall2009-10-241-6/+11
| | | | | | | | | template instantiation. Preserve it through PCH. Show it off to the indexer. I'm healthily ignoring the vector type cases because we don't have a sensible TypeLoc implementation for them anyway. llvm-svn: 84994
* PR5218: Replace IdentifierInfo::getName with StringRef version, now that clientsDaniel Dunbar2009-10-181-3/+3
| | | | | | are updated. llvm-svn: 84447
* Simplify HandleModeAttr.Daniel Dunbar2009-10-181-11/+8
| | | | llvm-svn: 84391
* Simplify HandleFormatAttr.Daniel Dunbar2009-10-181-35/+41
| | | | | | | | | | | | | | | - I have this crazy dream that one day someone will invent a miraculous tool so that developers, instead of hand optimizing their source code to obscure its intent and decrease its maleability, will instead write what they mean, and this strange and wonderful tool -- which I imagine would be called something fancy sounding like "an optimizing compiler" -- will make their code fast *for* them. With all the saved time, developers could maybe even focus on making the magic "optimizing compiler" better!! - No intended functionality change, all though I expect the universe to mock me for snarkiness. llvm-svn: 84390
* Fix for PR 5181.Edward O'Callaghan2009-10-131-1/+4
| | | | llvm-svn: 84051
* Refactor the LookupResult API to simplify most common operations. Require ↵John McCall2009-10-091-2/+3
| | | | | | | | | users to pass a LookupResult reference to lookup routines. Call out uses which assume a single result. llvm-svn: 83674
* Change all the Type::getAsFoo() methods to specializations of Type::getAs().John McCall2009-09-211-7/+7
| | | | | | | | | | | Several of the existing methods were identical to their respective specializations, and so have been removed entirely. Several more 'leaf' optimizations were introduced. The getAsFoo() methods which imposed extra conditions, like getAsObjCInterfacePointerType(), have been left in place. llvm-svn: 82501
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-9/+8
| | | | llvm-svn: 81346
* reduce indentation.Chris Lattner2009-09-081-17/+16
| | | | llvm-svn: 81234
* Regularize the case and sort.Mike Stump2009-08-261-6/+6
| | | | llvm-svn: 80163
* Handle the implicit 'this' parameter for format attributes.Anders Carlsson2009-08-251-3/+12
| | | | llvm-svn: 79987
* Enhance diagnostics concerning attribute 'ns_returns_retained' and ↵Ted Kremenek2009-08-191-4/+6
| | | | | | 'cf_returns_retained' to present the range of the attribute and have the diagnostic location be the declaration that the attribute was falsely attached to. This solves the problem where these diagnostics were being suppressed when these attributes were wrapped in a macro that was defined in a system header. llvm-svn: 79496
* Introduce DeclaratorDecl and pass DeclaratorInfo through the Decl/Sema ↵Argyrios Kyrtzidis2009-08-191-2/+3
| | | | | | | | | | | | interfaces. DeclaratorDecl contains a DeclaratorInfo* to keep type source info. Subclasses of DeclaratorDecl are FieldDecl, FunctionDecl, and VarDecl. EnumConstantDecl still inherits from ValueDecl since it has no need for DeclaratorInfo. Decl/Sema interfaces accept a DeclaratorInfo as parameter but no DeclaratorInfo is created yet. llvm-svn: 79392
* Change handling of attribute 'malloc' to only accept the attribute on functionTed Kremenek2009-08-151-14/+7
| | | | | | | | | | declarations (and not function pointers). This is consistent with GCC. Accepting this attribute on function pointers means that the attribute should be treated as a type qualifier, which apparently is not what GCC does. We obviously can change this later should we desire to enhance the 'malloc' attribute in this way. llvm-svn: 79060
* Per Eli Friedman's feedback, handle attribute 'malloc' being applied toTed Kremenek2009-08-141-5/+5
| | | | | | declarations of function pointers. llvm-svn: 79053
* Use 'dyn_cast' instead of a check for a function declaration followed by aTed Kremenek2009-08-141-2/+3
| | | | | | 'cast'. llvm-svn: 79041
* Improve Sema's handling of attribute 'malloc' to reject the attribute whenTed Kremenek2009-08-141-18/+26
| | | | | | | | | | | attaching to Objective-C methods (which mirrors GCC's behavior) and to allow the return type of the function to be an Objective-C pointer or Block pointer (which GCC also accepts). Along the way, add 'const' to some of the pointer arguments of various utility functions... llvm-svn: 79040
* change cast to dyn_cast because d may not be a FunctionDeclRyan Flynn2009-08-131-1/+1
| | | | llvm-svn: 78876
* change a dyn_cast to castRyan Flynn2009-08-121-1/+1
| | | | llvm-svn: 78862
* fix a couple of problems with section attributes:Chris Lattner2009-08-101-10/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Passing something that isn't a string used to cause: "argument to annotate attribute was not a string literal" make it say "section attribute" instead. 2. Fix the location of the above message to point to the bad argument instead of the section token. 3. Implement rdar://4341926, by diagnosing invalid section specifiers in the frontend rather than letting them slip all the way to the assembler (a QoI win). An example of #3 is that we used to produce something like this: /var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Expected comma after segment-name /var/folders/n7/n7Yno9ihEm894640nJdSQU+++TI/-Tmp-//ccFPFGtT.s:2:Rest of line ignored. 1st junk character valued 46 (.). Daniel improved clang to use llvm_report_error, so now we got: $ clang t.c -c fatal error: error in backend: Global variable 'x' has an invalid section specifier 'sadf': mach-o section specifier requires a segment and section separated by a comma. with no loc info. Now we get: $ clang t.c -fsyntax-only t.c:4:30: error: argument to 'section' attribute is not valid for this target: mach-o section specifier requires a segment and section separated by a comma int x __attribute__((section("sadf"))); ^ which is nice :) llvm-svn: 78586
* warn, as gcc does, if __attribute__((malloc)) applied to function returning ↵Ryan Flynn2009-08-091-0/+7
| | | | | | non-pointer type llvm-svn: 78542
* map previously ignored __attribute((malloc)) to noalias attribute of llvm ↵Ryan Flynn2009-08-091-0/+17
| | | | | | function's return llvm-svn: 78541
* Introduce a new PragmaPack attribute, and use it for #pragma pack. The ↵Anders Carlsson2009-08-081-2/+2
| | | | | | | | PackedAttr now only represents __attribute__((packed)). This is necessary because #pragma pack and __attribute__((packed)) have different semantics. No functionality change yet, but this lays the groundwork for fixing a record layout bug. llvm-svn: 78483
* add support for FreeBSD's format(printf0,x,y) attribute; allows null format ↵Ryan Flynn2009-08-061-1/+2
| | | | | | string. llvm-svn: 78276
* Canonicalize else.Mike Stump2009-08-041-2/+1
| | | | llvm-svn: 78102
* PR3679 - enable #pragma weak aliasing.Ryan Flynn2009-07-311-6/+12
| | | | llvm-svn: 77660
* PR3679 - handle #pragma weakRyan Flynn2009-07-301-0/+47
| | | | llvm-svn: 77573
* Change uses of:Ted Kremenek2009-07-291-10/+10
| | | | | | | | | | | | | | | | | | | | Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsRecordType() -> Type::getAs<RecordType>() Type::getAsPointerType() -> Type::getAs<PointerType>() Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>() Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>() Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>() Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>() Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsTagType() -> Type::getAs<TagType>() And remove Type::getAsReferenceType(), etc. This change is similar to one I made a couple weeks ago, but that was partly reverted pending some additional design discussion. With Doug's pending smart pointer changes for Types, it seemed natural to take this approach. llvm-svn: 77510
* Fix 80-col violations, reflow a few comments and zap some extraMike Stump2009-07-241-159/+158
| | | | | | whitespace at ends of lines. llvm-svn: 76992
* Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methodsTed Kremenek2009-07-171-10/+10
| | | | | | | | | until Doug Gregor's Type smart pointer code lands (or more discussion occurs). These methods just call the new Type::getAs<XXX> methods, so we still have reduced implementation redundancy. Having explicit getAsXXXType() methods makes it easier to set breakpoints in the debugger. llvm-svn: 76193
* Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), ↵Ted Kremenek2009-07-171-1/+1
| | | | | | Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents. llvm-svn: 76139
* Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.Ted Kremenek2009-07-161-9/+9
| | | | | | | | | | | | | | | | | | | | | This method is intended to eventually replace the individual Type::getAsXXXType<> methods. The motivation behind this change is twofold: 1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of them are basically copy-and-paste. 2) By centralizing the implementation of the getAs<Type> logic we can more smoothly move over to Doug Gregor's proposed canonical type smart pointer scheme. Along with this patch: a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>. b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>. llvm-svn: 76098
* Generate error on declaration containing 'static' and '__attribute__((weak))'Fariborz Jahanian2009-07-161-0/+13
| | | | | | Patch by Ryan Flynn llvm-svn: 75879
* Handle some more fallout with the conversion of using PointerType forTed Kremenek2009-07-151-2/+2
| | | | | | | | | | | | | | | Objective-C pointers to using ObjCObjectPointerType. Now the checking for 'attribute ((nonnull))' in Sema doesn't emit an error when trying to apply that attribute to a parameter that is an Objective-C pointer (this is a regression). To prevent this regression from occuring in the future, the 'nonnull.c' test was moved to test/SemaObjC and renamed 'nonnull.m'. I also enhanced the tests to show that function calls involved a NULL Objective-C pointer constant does not trigger a warning. This is consistent with GCC, but should likely be fixed. llvm-svn: 75856
OpenPOWER on IntegriCloud