Author: rtrieu Date: Wed Apr 11 19:26:49 2018 New Revision: 329869 URL: http://llvm.org/viewvc/llvm-project?rev=329869&view=rev Log: [ODRHash] Skip more types hashing TypedefType
To get the underlying type for TypedefType's, also skip ElaboratedType's. Modified: cfe/trunk/lib/AST/ODRHash.cpp cfe/trunk/test/Modules/odr_hash.cpp Modified: cfe/trunk/lib/AST/ODRHash.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=329869&r1=329868&r2=329869&view=diff ============================================================================== --- cfe/trunk/lib/AST/ODRHash.cpp (original) +++ cfe/trunk/lib/AST/ODRHash.cpp Wed Apr 11 19:26:49 2018 @@ -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); Modified: cfe/trunk/test/Modules/odr_hash.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/odr_hash.cpp?rev=329869&r1=329868&r2=329869&view=diff ============================================================================== --- cfe/trunk/test/Modules/odr_hash.cpp (original) +++ cfe/trunk/test/Modules/odr_hash.cpp Wed Apr 11 19:26:49 2018 @@ -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 { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits