diff options
author | Chris Lattner <sabre@nondot.org> | 2008-06-29 00:19:33 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-06-29 00:19:33 +0000 |
commit | c4ecec545e46ed0c379aa1ca2d414a1aa77319c1 (patch) | |
tree | ed24653e4e4d5548a19c70734f4b7556cec73768 | |
parent | 58418ffa32a0eeacfe59fab70449bbcef7c5680a (diff) | |
download | bcm5719-llvm-c4ecec545e46ed0c379aa1ca2d414a1aa77319c1.tar.gz bcm5719-llvm-c4ecec545e46ed0c379aa1ca2d414a1aa77319c1.zip |
handle type attributes when converting types, not when processing decls.
llvm-svn: 52877
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 17 | ||||
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 5 |
2 files changed, 6 insertions, 16 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 28905314ee8..9f63c936e90 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -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 diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index bf023394f33..8fadd80f8bd 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -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; } |