]> granicus.if.org Git - clang/commitdiff
move some code from all callers of ProcessDeclAttributes into
authorChris Lattner <sabre@nondot.org>
Sun, 29 Jun 2008 00:02:00 +0000 (00:02 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 29 Jun 2008 00:02:00 +0000 (00:02 +0000)
the implementation of ProcessDeclAttributes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52875 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/Sema.h
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclAttr.cpp

index d2c8f224c847ca62d4659aaab603a5f5120cafce..da1747aab107cacc0870718becd474c0414c5032 100644 (file)
@@ -301,8 +301,7 @@ private:
   ScopedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
                                  Scope *S);
   // Decl attributes - this routine is the top level dispatcher. 
-  void ProcessDeclAttributes(Decl *New, const AttributeList *DeclSpecAttrs,
-                             const AttributeList *DeclaratorAttrs);
+  void ProcessDeclAttributes(Decl *D, Declarator &PD);
   void ProcessDeclAttributeList(Decl *D, const AttributeList *AttrList);
   void ProcessDeclAttribute(Decl *D, const AttributeList &Attr);
 
@@ -312,9 +311,7 @@ private:
   /// for the type.
   QualType HandleAddressSpaceTypeAttribute(QualType curType, 
                                            const AttributeList &Attr);
-
   void HandleModeAttribute(Decl *d, const AttributeList &Attr);
-
   void HandleVectorSizeAttribute(Decl *d, const AttributeList &Attr);
   void HandleExtVectorTypeAttribute(Decl *d, const AttributeList &Attr);
   void HandleAlignedAttribute(Decl *d, const AttributeList &Attr);
index 7fa180ccefad0727e1cd62024b78b1e4cb8a01a5..6b528b6bed4dc4e0a45207c6c0d48caa75f6e6e8 100644 (file)
@@ -612,8 +612,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
     if (!NewTD) return 0;
 
     // Handle attributes prior to checking for duplicates in MergeVarDecl
-    ProcessDeclAttributes(NewTD, D.getDeclSpec().getAttributes(),
-                          D.getAttributes());
+    ProcessDeclAttributes(NewTD, D);
     // Merge the decl with the existing one if appropriate. If the decl is
     // in an outer scope, it isn't the same thing.
     if (PrevDecl && IdResolver.isDeclInScope(PrevDecl, CurContext, S)) {
@@ -652,8 +651,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
                                                II, R, SC, isInline,
                                                LastDeclarator);
     // Handle attributes.
-    ProcessDeclAttributes(NewFD, D.getDeclSpec().getAttributes(),
-                          D.getAttributes());
+    ProcessDeclAttributes(NewFD, D);
 
     // Copy the parameter declarations from the declarator D to
     // the function declaration NewFD, if they are available.
@@ -745,8 +743,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
                               II, R, SC, LastDeclarator);
     }
     // Handle attributes prior to checking for duplicates in MergeVarDecl
-    ProcessDeclAttributes(NewVD, D.getDeclSpec().getAttributes(),
-                          D.getAttributes());
+    ProcessDeclAttributes(NewVD, D);
 
     // Emit an error if an address space was applied to decl with local storage.
     // This includes arrays of objects with address space qualifiers, but not
@@ -1456,8 +1453,7 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
   if (II)
     PushOnScopeChains(New, S);
 
-  ProcessDeclAttributes(New, D.getDeclSpec().getAttributes(),
-                        D.getAttributes());
+  ProcessDeclAttributes(New, D);
   return New;
 
 }
@@ -1849,8 +1845,7 @@ Sema::DeclTy *Sema::ActOnField(Scope *S,
   // FIXME: Chain fielddecls together.
   FieldDecl *NewFD = FieldDecl::Create(Context, Loc, II, T, BitWidth);
   
-  ProcessDeclAttributes(NewFD, D.getDeclSpec().getAttributes(),
-                        D.getAttributes());
+  ProcessDeclAttributes(NewFD, D);
 
   if (D.getInvalidType() || InvalidDecl)
     NewFD->setInvalidDecl();
@@ -1913,8 +1908,7 @@ Sema::DeclTy *Sema::ActOnIvar(Scope *S,
   
   ObjCIvarDecl *NewID = ObjCIvarDecl::Create(Context, Loc, II, T);
   
-  ProcessDeclAttributes(NewID, D.getDeclSpec().getAttributes(),
-                        D.getAttributes());
+  ProcessDeclAttributes(NewID, D);
   
   if (D.getInvalidType() || InvalidDecl)
     NewID->setInvalidDecl();
index 752a0fb3e1a8eba6c5b620ee382ed7d7476e3528..cdb54856665e09c6b0d52285174a3db30d1cf8fe 100644 (file)
@@ -54,8 +54,10 @@ static inline bool isNSStringType(QualType T, ASTContext &Ctx) {
          ClsName == &Ctx.Idents.get("NSMutableString");
 }
 
-void Sema::ProcessDeclAttributes(Decl *D, const AttributeList *DeclSpecAttrs,
-                                 const AttributeList *DeclaratorAttrs) {
+void Sema::ProcessDeclAttributes(Decl *D, Declarator &PD) {
+  const AttributeList *DeclSpecAttrs = PD.getDeclSpec().getAttributes();
+  const AttributeList *DeclaratorAttrs = PD.getAttributes();
+  
   if (DeclSpecAttrs == 0 && DeclaratorAttrs == 0) return;
 
   ProcessDeclAttributeList(D, DeclSpecAttrs);