summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/ODRHash.cpp2
-rw-r--r--clang/test/Modules/odr_hash.cpp33
2 files changed, 34 insertions, 1 deletions
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index 83168d0924f..f4d314a6dd0 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -411,7 +411,7 @@ public:
void VisitTypedefType(const TypedefType *T) {
AddDecl(T->getDecl());
- Hash.AddQualType(T->getDecl()->getUnderlyingType());
+ AddQualType(T->getDecl()->getUnderlyingType().getCanonicalType());
VisitType(T);
}
};
diff --git a/clang/test/Modules/odr_hash.cpp b/clang/test/Modules/odr_hash.cpp
index 294e925627c..58814dd6b3f 100644
--- a/clang/test/Modules/odr_hash.cpp
+++ b/clang/test/Modules/odr_hash.cpp
@@ -1078,6 +1078,39 @@ S<X> s;
#endif
}
+namespace MultipleTypedefs {
+#if defined(FIRST)
+typedef int B1;
+typedef B1 A1;
+struct S1 {
+ A1 x;
+};
+#elif defined(SECOND)
+typedef int A1;
+struct S1 {
+ A1 x;
+};
+#else
+S1 s1;
+#endif
+
+#if defined(FIRST)
+struct T2 { int x; };
+typedef T2 B2;
+typedef B2 A2;
+struct S2 {
+ T2 x;
+};
+#elif defined(SECOND)
+struct T2 { int x; };
+typedef T2 A2;
+struct S2 {
+ T2 x;
+};
+#else
+S2 s2;
+#endif
+}
// Keep macros contained to one file.
#ifdef FIRST
OpenPOWER on IntegriCloud