summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorEnea Zaffanella <zaffanella@cs.unipr.it>2013-06-20 12:46:19 +0000
committerEnea Zaffanella <zaffanella@cs.unipr.it>2013-06-20 12:46:19 +0000
commita86d88c7cdc40bf7102a073196999ee5f810280a (patch)
treea329c9a33b4395fa51d36aef1b8980b1c818ee20 /clang/lib/Sema/SemaDeclAttr.cpp
parent85ae66bf4883eb295c3f8414c782e2cdce2933e5 (diff)
downloadbcm5719-llvm-a86d88c7cdc40bf7102a073196999ee5f810280a.tar.gz
bcm5719-llvm-a86d88c7cdc40bf7102a073196999ee5f810280a.zip
Improved source code fidelity for gcc mode attribute.
llvm-svn: 184417
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 684148879b2..9a68ca5a752 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -3740,11 +3740,14 @@ static void handleModeAttr(Sema &S, Decl *D, const AttributeList &Attr) {
}
// Install the new type.
- if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D)) {
- // FIXME: preserve existing source info.
- TD->setTypeSourceInfo(S.Context.getTrivialTypeSourceInfo(NewTy));
- } else
+ if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D))
+ TD->setModedTypeSourceInfo(TD->getTypeSourceInfo(), NewTy);
+ else
cast<ValueDecl>(D)->setType(NewTy);
+
+ D->addAttr(::new (S.Context)
+ ModeAttr(Attr.getRange(), S.Context, Name,
+ Attr.getAttributeSpellingListIndex()));
}
static void handleNoDebugAttr(Sema &S, Decl *D, const AttributeList &Attr) {
OpenPOWER on IntegriCloud