summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/ODRHash.cpp16
-rw-r--r--clang/test/Modules/odr_hash.cpp32
2 files changed, 45 insertions, 3 deletions
diff --git a/clang/lib/AST/ODRHash.cpp b/clang/lib/AST/ODRHash.cpp
index 528e32aaba2..0ee30fbd9b2 100644
--- a/clang/lib/AST/ODRHash.cpp
+++ b/clang/lib/AST/ODRHash.cpp
@@ -646,9 +646,19 @@ public:
AddDecl(T->getDecl());
QualType UnderlyingType = T->getDecl()->getUnderlyingType();
VisitQualifiers(UnderlyingType.getQualifiers());
- while (const TypedefType *Underlying =
- dyn_cast<TypedefType>(UnderlyingType.getTypePtr())) {
- UnderlyingType = Underlying->getDecl()->getUnderlyingType();
+ while (true) {
+ if (const TypedefType *Underlying =
+ dyn_cast<TypedefType>(UnderlyingType.getTypePtr())) {
+ UnderlyingType = Underlying->getDecl()->getUnderlyingType();
+ continue;
+ }
+ if (const ElaboratedType *Underlying =
+ dyn_cast<ElaboratedType>(UnderlyingType.getTypePtr())) {
+ UnderlyingType = Underlying->getNamedType();
+ continue;
+ }
+
+ break;
}
AddType(UnderlyingType.getTypePtr());
VisitType(T);
diff --git a/clang/test/Modules/odr_hash.cpp b/clang/test/Modules/odr_hash.cpp
index 5991dd0a733..b22ccdd0c8b 100644
--- a/clang/test/Modules/odr_hash.cpp
+++ b/clang/test/Modules/odr_hash.cpp
@@ -2744,6 +2744,38 @@ struct S3 {
#else
S3 s3;
#endif
+
+#if defined(FIRST)
+using A4 = int;
+using B4 = A4;
+struct S4 {
+ B4 x;
+};
+#elif defined(SECOND)
+using A4 = int;
+using B4 = ::MultipleTypedefs::A4;
+struct S4 {
+ B4 x;
+};
+#else
+S4 s4;
+#endif
+
+#if defined(FIRST)
+using A5 = int;
+using B5 = MultipleTypedefs::A5;
+struct S5 {
+ B5 x;
+};
+#elif defined(SECOND)
+using A5 = int;
+using B5 = ::MultipleTypedefs::A5;
+struct S5 {
+ B5 x;
+};
+#else
+S5 s5;
+#endif
} // MultipleTypedefs
namespace DefaultArguments {
OpenPOWER on IntegriCloud