r321319 - [ODRHash] Canonicalize Decl's before processing.

Richard Trieu via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 21 14:38:30 PST 2017

Author: rtrieu
Date: Thu Dec 21 14:38:29 2017
New Revision: 321319

URL: http://llvm.org/viewvc/llvm-project?rev=321319&view=rev
[ODRHash] Canonicalize Decl's before processing.

Canonicalizing the Decl before processing it as part of the hash should reduce
issues with non-canonical types showing up as mismatches.


Modified: cfe/trunk/lib/AST/ODRHash.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=321319&r1=321318&r2=321319&view=diff
--- cfe/trunk/lib/AST/ODRHash.cpp (original)
+++ cfe/trunk/lib/AST/ODRHash.cpp Thu Dec 21 14:38:29 2017
@@ -468,6 +468,7 @@ void ODRHash::AddCXXRecordDecl(const CXX
 void ODRHash::AddDecl(const Decl *D) {
   assert(D && "Expecting non-null pointer.");
+  D = D->getCanonicalDecl();
   auto Result = DeclMap.insert(std::make_pair(D, DeclMap.size()));
   // On first encounter of a Decl pointer, process it.  Every time afterwards,

More information about the cfe-commits mailing list