diff options
author | John McCall <rjmccall@apple.com> | 2010-12-24 02:08:15 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-12-24 02:08:15 +0000 |
commit | 53fa71476d0539b031a8f91232607f5ca8f182e5 (patch) | |
tree | 9e6d370da16c00a54a4b7f8ad66553458cedf899 /clang/lib/Sema | |
parent | b4d271ef46bde4815c3ca3363779645ce3513811 (diff) | |
download | bcm5719-llvm-53fa71476d0539b031a8f91232607f5ca8f182e5.tar.gz bcm5719-llvm-53fa71476d0539b031a8f91232607f5ca8f182e5.zip |
Refactor how we collect attributes during parsing, and add slots for attributes
on array and function declarators. This is pretty far from complete, and I'll
revisit it later if someone doesn't beat me to it.
llvm-svn: 122535
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/AttributeList.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/DeclSpec.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 5 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 2 |
5 files changed, 11 insertions, 8 deletions
diff --git a/clang/lib/Sema/AttributeList.cpp b/clang/lib/Sema/AttributeList.cpp index 6aa9690476a..6e0a3321048 100644 --- a/clang/lib/Sema/AttributeList.cpp +++ b/clang/lib/Sema/AttributeList.cpp @@ -21,10 +21,10 @@ AttributeList::AttributeList(llvm::BumpPtrAllocator &Alloc, IdentifierInfo *sName, SourceLocation sLoc, IdentifierInfo *pName, SourceLocation pLoc, Expr **ExprList, unsigned numArgs, - AttributeList *n, bool declspec, bool cxx0x) + bool declspec, bool cxx0x) : AttrName(aName), AttrLoc(aLoc), ScopeName(sName), ScopeLoc(sLoc), - ParmName(pName), ParmLoc(pLoc), NumArgs(numArgs), Next(n), + ParmName(pName), ParmLoc(pLoc), NumArgs(numArgs), Next(0), DeclspecAttribute(declspec), CXX0XAttribute(cxx0x), Invalid(false) { if (numArgs == 0) diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index 5304193b664..4afdc24275f 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/lib/Sema/DeclSpec.cpp @@ -46,7 +46,8 @@ void UnqualifiedId::setConstructorTemplateId(TemplateIdAnnotation *TemplateId) { /// DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function. /// "TheDeclarator" is the declarator that this will be added to. -DeclaratorChunk DeclaratorChunk::getFunction(bool hasProto, bool isVariadic, +DeclaratorChunk DeclaratorChunk::getFunction(const ParsedAttributes &attrs, + bool hasProto, bool isVariadic, SourceLocation EllipsisLoc, ParamInfo *ArgInfo, unsigned NumArgs, @@ -65,6 +66,7 @@ DeclaratorChunk DeclaratorChunk::getFunction(bool hasProto, bool isVariadic, I.Kind = Function; I.Loc = LPLoc; I.EndLoc = RPLoc; + I.Fun.AttrList = attrs.getList(); I.Fun.hasPrototype = hasProto; I.Fun.isVariadic = isVariadic; I.Fun.EllipsisLoc = EllipsisLoc.getRawEncoding(); @@ -483,7 +485,7 @@ void DeclSpec::SaveWrittenBuiltinSpecs() { writtenBS.Type = getTypeSpecType(); // Search the list of attributes for the presence of a mode attribute. writtenBS.ModeAttr = false; - AttributeList* attrs = getAttributes(); + AttributeList* attrs = getAttributes().getList(); while (attrs) { if (attrs->getKind() == AttributeList::AT_mode) { writtenBS.ModeAttr = true; diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index d5966494790..62262bc60b5 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1642,7 +1642,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, } if (RecordDecl *Record = dyn_cast_or_null<RecordDecl>(Tag)) { - ProcessDeclAttributeList(S, Record, DS.getAttributes()); + ProcessDeclAttributeList(S, Record, DS.getAttributes().getList()); if (!Record->getDeclName() && Record->isDefinition() && DS.getStorageClassSpec() != DeclSpec::SCS_typedef) { @@ -5553,7 +5553,8 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, (void)Error; // Silence warning. assert(!Error && "Error setting up implicit decl!"); Declarator D(DS, Declarator::BlockContext); - D.AddTypeInfo(DeclaratorChunk::getFunction(false, false, SourceLocation(), 0, + D.AddTypeInfo(DeclaratorChunk::getFunction(ParsedAttributes(), + false, false, SourceLocation(), 0, 0, 0, false, SourceLocation(), false, 0,0,0, Loc, Loc, D), SourceLocation()); diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 06cb42ec0e0..6977a33ac4a 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2808,7 +2808,7 @@ void Sema::ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD) { } // Apply decl attributes from the DeclSpec if present. - if (const AttributeList *Attrs = PD.getDeclSpec().getAttributes()) + if (const AttributeList *Attrs = PD.getDeclSpec().getAttributes().getList()) ProcessDeclAttributeList(S, D, Attrs); // Walk the declarator structure, applying decl attributes that were in a type diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 46ec0fe1091..c70d5befbbf 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -402,7 +402,7 @@ static QualType ConvertDeclSpecToType(Sema &TheSema, // See if there are any attributes on the declspec that apply to the type (as // opposed to the decl). - if (const AttributeList *AL = DS.getAttributes()) + if (const AttributeList *AL = DS.getAttributes().getList()) ProcessTypeAttributeList(TheSema, Result, true, AL, Delayed); // Apply const/volatile/restrict qualifiers to T. |