[cfe-commits] r52875 - in /cfe/trunk/lib/Sema: Sema.h SemaDecl.cpp SemaDeclAttr.cpp

Chris Lattner sabre at nondot.org
Sat Jun 28 17:02:00 PDT 2008


Author: lattner
Date: Sat Jun 28 19:02:00 2008
New Revision: 52875

URL: http://llvm.org/viewvc/llvm-project?rev=52875&view=rev
Log:
move some code from all callers of ProcessDeclAttributes into 
the implementation of ProcessDeclAttributes.

Modified:
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=52875&r1=52874&r2=52875&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Sat Jun 28 19:02:00 2008
@@ -301,8 +301,7 @@
   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 @@
   /// 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);

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=52875&r1=52874&r2=52875&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Jun 28 19:02:00 2008
@@ -612,8 +612,7 @@
     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 @@
                                                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 @@
                               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 @@
   if (II)
     PushOnScopeChains(New, S);
 
-  ProcessDeclAttributes(New, D.getDeclSpec().getAttributes(),
-                        D.getAttributes());
+  ProcessDeclAttributes(New, D);
   return New;
 
 }
@@ -1849,8 +1845,7 @@
   // 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 @@
   
   ObjCIvarDecl *NewID = ObjCIvarDecl::Create(Context, Loc, II, T);
   
-  ProcessDeclAttributes(NewID, D.getDeclSpec().getAttributes(),
-                        D.getAttributes());
+  ProcessDeclAttributes(NewID, D);
   
   if (D.getInvalidType() || InvalidDecl)
     NewID->setInvalidDecl();

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=52875&r1=52874&r2=52875&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sat Jun 28 19:02:00 2008
@@ -54,8 +54,10 @@
          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);





More information about the cfe-commits mailing list