]> granicus.if.org Git - clang/commitdiff
[PCH] When deserializing an IdentifierInfo, call IdentifierInfo::RevertTokenIDToIdent...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 27 Feb 2013 01:13:51 +0000 (01:13 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 27 Feb 2013 01:13:51 +0000 (01:13 +0000)
Fixes an assertion hit.
rdar://13288735

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

lib/Serialization/ASTReader.cpp
test/Index/index-pch.cpp

index 4c11f383950b9a208b44a42e78435761a3a858ab..24073df3ec0766d828ef2f767b183907a27dce35 100644 (file)
@@ -538,7 +538,7 @@ IdentifierInfo *ASTIdentifierLookupTrait::ReadData(const internal_key_type& k,
 
   // Set or check the various bits in the IdentifierInfo structure.
   // Token IDs are read-only.
-  if (HasRevertedTokenIDToIdentifier)
+  if (HasRevertedTokenIDToIdentifier && II->getTokenID() != tok::identifier)
     II->RevertTokenIDToIdentifier();
   II->setObjCOrBuiltinID(ObjCOrBuiltinID);
   assert(II->isExtensionToken() == ExtensionToken &&
index c8da7b2fbf2a8d72f49a605eaef9e03dce794e15..caab2d7f97bd53b60362d0627a149f5a1b9f1733 100644 (file)
@@ -1,6 +1,8 @@
 // RUN: c-index-test -write-pch %t.pch -fshort-wchar %s
-// RUN: c-index-test -index-tu %t.pch | FileCheck %s
+// RUN: env LIBCLANG_NOTHREADS=1 c-index-test -index-tu %t.pch | FileCheck %s
 
+// CHECK: [indexDeclaration]: kind: variable | name: wideStr
 const wchar_t *wideStr = L"123";
 
-// CHECK: [indexDeclaration]: kind: variable | name: wideStr
+// CHECK: [indexDeclaration]: kind: struct | name: __is_void
+struct __is_void {};