forked from OSchip/llvm-project
[PCH] After deserializing a DeclContext, if it has external lexical decls but not
external visible decls, call DeclContext::setMustBuildLookupTable so that the "lazy decls" bit of the LookupPtr is set. Previously, in non-C++, if there were no new declarations causing the "lazy decls" bit to be set, then DeclContext::lookups_begin() would fail to return the decls from the PCH. Fixes rdar://12316296. llvm-svn: 164351
This commit is contained in:
parent
1a38004c1b
commit
6fa1682368
|
@ -1661,6 +1661,10 @@ ASTReader::ReadASTBlock(ModuleFile &F) {
|
|||
return Failure;
|
||||
}
|
||||
|
||||
DeclContext *DC = Context.getTranslationUnitDecl();
|
||||
if (!DC->hasExternalVisibleStorage() && DC->hasExternalLexicalStorage())
|
||||
DC->setMustBuildLookupTable();
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
|
@ -2127,6 +2127,9 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) {
|
|||
}
|
||||
PendingVisibleUpdates.erase(I);
|
||||
}
|
||||
|
||||
if (!DC->hasExternalVisibleStorage() && DC->hasExternalLexicalStorage())
|
||||
DC->setMustBuildLookupTable();
|
||||
}
|
||||
assert(Idx == Record.size());
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
// RUN: c-index-test -write-pch %t.h.pch %s
|
||||
// RUN: c-index-test -code-completion-at=%s:19:1 %s -include %t.h | FileCheck %s
|
||||
|
||||
// <rdar://12316296> clang Code Completion returns nothing but preprocessor macros
|
||||
|
||||
#ifndef HEADER
|
||||
#define HEADER
|
||||
|
||||
@interface I
|
||||
@end
|
||||
|
||||
// CHECK: FunctionDecl:{ResultType void}{TypedText foo}
|
||||
void foo();
|
||||
|
||||
#else
|
||||
|
||||
@implementation I
|
||||
-(void)meth {
|
||||
|
||||
}
|
||||
@end
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue