aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-10-24 08:00:42 +0000
committerJohn McCall <rjmccall@apple.com>2009-10-24 08:00:42 +0000
commitba6a9bd384df475780be636ca45bcef5c5bbd19f (patch)
tree5a424cd2045611749ab24e8da7d7d872f3f9d5f8 /lib/Sema/SemaDeclAttr.cpp
parent3eefb1c4bd2c562e43f25e0dba657bb32361dd14 (diff)
Preserve type source information in TypedefDecls. Preserve it across
template instantiation. Preserve it through PCH. Show it off to the indexer. I'm healthily ignoring the vector type cases because we don't have a sensible TypeLoc implementation for them anyway. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84994 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 341d49ead4..090a6cd540 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -193,7 +193,8 @@ static void HandleExtVectorTypeAttr(Scope *scope, Decl *d,
// This will run the reguired checks.
QualType T = S.BuildExtVectorType(curType, S.Owned(sizeExpr), Attr.getLoc());
if (!T.isNull()) {
- tDecl->setUnderlyingType(T);
+ // FIXME: preserve the old source info.
+ tDecl->setTypeDeclaratorInfo(S.Context.getTrivialDeclaratorInfo(T));
// Remember this typedef decl, we will need it later for diagnostics.
S.ExtVectorDecls.push_back(tDecl);
@@ -278,8 +279,11 @@ static void HandleVectorSizeAttr(Decl *D, const AttributeList &Attr, Sema &S) {
if (ValueDecl *VD = dyn_cast<ValueDecl>(D))
VD->setType(CurType);
- else
- cast<TypedefDecl>(D)->setUnderlyingType(CurType);
+ else {
+ // FIXME: preserve existing source info.
+ DeclaratorInfo *DInfo = S.Context.getTrivialDeclaratorInfo(CurType);
+ cast<TypedefDecl>(D)->setTypeDeclaratorInfo(DInfo);
+ }
}
static void HandlePackedAttr(Decl *d, const AttributeList &Attr, Sema &S) {
@@ -1636,9 +1640,10 @@ static void HandleModeAttr(Decl *D, const AttributeList &Attr, Sema &S) {
}
// Install the new type.
- if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D))
- TD->setUnderlyingType(NewTy);
- else
+ if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) {
+ // FIXME: preserve existing source info.
+ TD->setTypeDeclaratorInfo(S.Context.getTrivialDeclaratorInfo(NewTy));
+ } else
cast<ValueDecl>(D)->setType(NewTy);
}