From ddee8c9e2be901d90149c1ccc1804b6765fcc794 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 27 Feb 2013 01:13:51 +0000 Subject: [PATCH] [PCH] When deserializing an IdentifierInfo, call IdentifierInfo::RevertTokenIDToIdentifier() only when it's not already an identifier. Fixes an assertion hit. rdar://13288735 llvm-svn: 176148 --- clang/lib/Serialization/ASTReader.cpp | 2 +- clang/test/Index/index-pch.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 4c11f38..24073df 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -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 && diff --git a/clang/test/Index/index-pch.cpp b/clang/test/Index/index-pch.cpp index c8da7b2..caab2d7 100644 --- a/clang/test/Index/index-pch.cpp +++ b/clang/test/Index/index-pch.cpp @@ -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 {}; -- 2.7.4