summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ODRHash.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2017-06-29 22:53:04 +0000
committerRichard Trieu <rtrieu@google.com>2017-06-29 22:53:04 +0000
commit3e03d3ee547d8fb03b39e0446af48d379de05871 (patch)
tree5775c84ca42ae854c8734dc381dc31425fae76d4 /clang/lib/AST/ODRHash.cpp
parentd2d4c8db457daff37f89905bf4229fe2b719ed85 (diff)
[ODRHash] Improve typedef handling.
Follow typedef chains to find the root type when processing types, and also keep track of qualifiers. llvm-svn: 306753
Diffstat (limited to 'clang/lib/AST/ODRHash.cpp')
-rw-r--r--clang/lib/AST/ODRHash.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index 05bed658f3fc..5c8d151e0818 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -430,6 +430,13 @@ public:
Hash.AddQualType(T);
}
+ void AddType(const Type *T) {
+ Hash.AddBoolean(T);
+ if (T) {
+ Hash.AddType(T);
+ }
+ }
+
void AddNestedNameSpecifier(const NestedNameSpecifier *NNS) {
Hash.AddNestedNameSpecifier(NNS);
}
@@ -517,7 +524,13 @@ public:
void VisitTypedefType(const TypedefType *T) {
AddDecl(T->getDecl());
- AddQualType(T->getDecl()->getUnderlyingType().getCanonicalType());
+ QualType UnderlyingType = T->getDecl()->getUnderlyingType();
+ VisitQualifiers(UnderlyingType.getQualifiers());
+ while (const TypedefType *Underlying =
+ dyn_cast<TypedefType>(UnderlyingType.getTypePtr())) {
+ UnderlyingType = Underlying->getDecl()->getUnderlyingType();
+ }
+ AddType(UnderlyingType.getTypePtr());
VisitType(T);
}