[PCH] When keeping track of top-level decls for "targeted deserialization"

make sure we don't mistake ParmVarDecls for top-level decls.

Fixes rdar://10920009.

llvm-svn: 151330
This commit is contained in:
Argyrios Kyrtzidis 2012-02-24 01:12:38 +00:00
parent 3a21e2c33e
commit ffe055a86f
3 changed files with 16 additions and 0 deletions

View File

@ -3860,6 +3860,9 @@ void ASTWriter::associateDeclWithFile(const Decl *D, DeclID ID) {
// We only keep track of the file-level declarations of each file.
if (!D->getLexicalDeclContext()->isFileContext())
return;
// FIXME: We should never have ParmVarDecls with TU as context.
if (isa<ParmVarDecl>(D))
return;
SourceManager &SM = Context->getSourceManager();
SourceLocation FileLoc = SM.getFileLoc(Loc);

View File

@ -0,0 +1,6 @@
// rdar://10920009
// RUN: c-index-test -write-pch %t.h.pch -x objective-c-header %S/targeted-cursor.m.h -Xclang -detailed-preprocessing-record
// RUN: c-index-test -cursor-at=%S/targeted-cursor.m.h:5:13 %s -include %t.h | FileCheck %s
// CHECK: ObjCClassRef=I:2:12

View File

@ -0,0 +1,7 @@
@interface I
-(void)mm:(void (^)(I*))block;
-(void)mm2:(I*)i;
@end