[cfe-commits] r52877 - in /cfe/trunk/lib/Sema: SemaDeclAttr.cpp SemaType.cpp

Chris Lattner sabre at nondot.org
Sat Jun 28 17:19:34 PDT 2008


Author: lattner
Date: Sat Jun 28 19:19:33 2008
New Revision: 52877

URL: http://llvm.org/viewvc/llvm-project?rev=52877&view=rev
Log:
handle type attributes when converting types, not when processing decls.

Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/lib/Sema/SemaType.cpp

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sat Jun 28 19:19:33 2008
@@ -78,23 +78,8 @@
       ProcessDeclAttributeList(D, Attrs);
   
   // Finally, apply any attributes on the decl itself.
-  if (const AttributeList *Attrs = PD.getAttributes()) {
+  if (const AttributeList *Attrs = PD.getAttributes())
     ProcessDeclAttributeList(D, Attrs);
-   
-    // If there are any type attributes that were in the declarator, apply them to
-    // its top-level type.
-    // FIXME: we shouldn't allow type attributes here. :(
-    if (ValueDecl *VD = dyn_cast<ValueDecl>(D)) {
-      QualType DT = VD->getType();
-      ProcessTypeAttributes(DT, Attrs);
-      VD->setType(DT);
-    } else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
-      QualType DT = TD->getUnderlyingType();
-      ProcessTypeAttributes(DT, Attrs);
-      TD->setUnderlyingType(DT);
-    }
-    // FIXME: field decl?
-  }
 }
 
 /// ProcessDeclAttributeList - Apply all the decl attributes in the specified

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Sat Jun 28 19:19:33 2008
@@ -456,6 +456,11 @@
     }
   }
   
+  // If there were any type attributes applied to the decl itself (not the
+  // type, apply the type attribute to the type!)
+  if (const AttributeList *Attrs = D.getAttributes())
+    ProcessTypeAttributes(T, Attrs);
+  
   return T;
 }
 





More information about the cfe-commits mailing list