/// AddDecl - Link the decl to its shadowed decl chain.
void IdentifierResolver::AddDecl(NamedDecl *D) {
DeclarationName Name = D->getDeclName();
+ if (IdentifierInfo *II = Name.getAsIdentifierInfo())
+ II->setIsFromPCH(false);
+
void *Ptr = Name.getFETokenInfo<void>();
if (!Ptr) {
void IdentifierResolver::RemoveDecl(NamedDecl *D) {
assert(D && "null param passed");
DeclarationName Name = D->getDeclName();
+ if (IdentifierInfo *II = Name.getAsIdentifierInfo())
+ II->setIsFromPCH(false);
+
void *Ptr = Name.getFETokenInfo<void>();
assert(Ptr && "Didn't find this decl on its identifier's chain!");
"Cannot replace a decl with another decl of a different name");
DeclarationName Name = Old->getDeclName();
+ if (IdentifierInfo *II = Name.getAsIdentifierInfo())
+ II->setIsFromPCH(false);
+
void *Ptr = Name.getFETokenInfo<void>();
if (!Ptr)
void IdentifierResolver::AddDeclToIdentifierChain(IdentifierInfo *II,
NamedDecl *D) {
+ II->setIsFromPCH(false);
void *Ptr = II->getFETokenInfo<void>();
if (!Ptr) {
--- /dev/null
+// Test this without pch.
+// RUN: %clang_cc1 -include %S/Inputs/chain-decls1.h -include %S/Inputs/chain-decls2.h -fsyntax-only -verify %s
+
+// Test with pch.
+// RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-decls1.h
+// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-decls2.h -include-pch %t1 -chained-pch
+// RUN: %clang_cc1 -include-pch %t2 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -ast-print -include-pch %t2 %s | FileCheck %s
+
+// CHECK: void f();
+// CHECK: void g();
+
+void h() {
+ f();
+ g();
+
+ struct one x;
+ one();
+ struct two y;
+ two();
+ struct three z;
+}
+++ /dev/null
-// RUN: %clang_cc1 -emit-pch -o %t1 %S/Inputs/chain-function1.h
-// RUN: %clang_cc1 -emit-pch -o %t2 %S/Inputs/chain-function2.h -include-pch %t1 -chained-pch
-// RUN: %clang_cc1 -fsyntax-only -verify -include-pch %t2 %s
-// RUN: %clang_cc1 -ast-print -include-pch %t2 %s | FileCheck %s
-
-// CHECK: void f();
-// CHECK: void g();
-
-void h() {
- f();
- g();
-}