]> granicus.if.org Git - clang/commitdiff
Fixed a bug where the ASTImporter didn't propagate builtin IDs at all.
authorSean Callanan <scallanan@apple.com>
Sat, 14 May 2016 06:11:19 +0000 (06:11 +0000)
committerSean Callanan <scallanan@apple.com>
Sat, 14 May 2016 06:11:19 +0000 (06:11 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269553 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTImporter.cpp

index c1dda3fcf65485c581d4dc2421f8c78f255598fa..702828bd11327712926394c188bd112a17ba411b 100644 (file)
@@ -6546,7 +6546,12 @@ IdentifierInfo *ASTImporter::Import(const IdentifierInfo *FromId) {
   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) {