]> granicus.if.org Git - clang/commitdiff
handle type attributes when converting types, not when processing decls.
authorChris Lattner <sabre@nondot.org>
Sun, 29 Jun 2008 00:19:33 +0000 (00:19 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 29 Jun 2008 00:19:33 +0000 (00:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52877 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp
lib/Sema/SemaType.cpp

index 28905314ee8dc7b21e4ffb628a55561ae6b84b1b..9f63c936e905ea36c8444c7ba55569981ffe2b5c 100644 (file)
@@ -78,23 +78,8 @@ void Sema::ProcessDeclAttributes(Decl *D, const Declarator &PD) {
       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
index bf023394f331223b83b3cdea3c23497a74228e66..8fadd80f8bda2400dcde009631cccbe0ffb04233 100644 (file)
@@ -456,6 +456,11 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
     }
   }
   
+  // 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;
 }