r269553 - Fixed a bug where the ASTImporter didn't propagate builtin IDs at all.

Sean Callanan via cfe-commits cfe-commits at lists.llvm.org
Fri May 13 23:11:19 PDT 2016


Author: spyffe
Date: Sat May 14 01:11:19 2016
New Revision: 269553

URL: http://llvm.org/viewvc/llvm-project?rev=269553&view=rev
Log:
Fixed a bug where the ASTImporter didn't propagate builtin IDs at all.

IdentifierInfos are assigned builtin IDs during parsing, but Idents.get() does 
not do that work.  So the ASTImporter needs to additionally set the builtin ID
for the newly-created IdentifierInfo.  This patch does that.

Currently ASTMerge tests only check syntax and the ASTMatchers don't check for
builtin IDs, so this is tricky to test, but LLDB will have a test for this.

Modified:
    cfe/trunk/lib/AST/ASTImporter.cpp

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=269553&r1=269552&r2=269553&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Sat May 14 01:11:19 2016
@@ -6546,7 +6546,12 @@ IdentifierInfo *ASTImporter::Import(cons
   if (!FromId)
     return nullptr;
 
-  return &ToContext.Idents.get(FromId->getName());
+  IdentifierInfo *ToId = &ToContext.Idents.get(FromId->getName());
+
+  if (!ToId->getBuiltinID() && FromId->getBuiltinID())
+    ToId->setBuiltinID(FromId->getBuiltinID());
+
+  return ToId;
 }
 
 Selector ASTImporter::Import(Selector FromSel) {




More information about the cfe-commits mailing list