[cfe-commits] r151330 - in /cfe/trunk: lib/Serialization/ASTWriter.cpp test/Index/targeted-cursor.m test/Index/targeted-cursor.m.h

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Feb 23 17:12:38 PST 2012


Author: akirtzidis
Date: Thu Feb 23 19:12:38 2012
New Revision: 151330

URL: http://llvm.org/viewvc/llvm-project?rev=151330&view=rev
Log:
[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.

Added:
    cfe/trunk/test/Index/targeted-cursor.m
    cfe/trunk/test/Index/targeted-cursor.m.h
Modified:
    cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=151330&r1=151329&r2=151330&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Thu Feb 23 19:12:38 2012
@@ -3860,6 +3860,9 @@
   // 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);

Added: cfe/trunk/test/Index/targeted-cursor.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/targeted-cursor.m?rev=151330&view=auto
==============================================================================
--- cfe/trunk/test/Index/targeted-cursor.m (added)
+++ cfe/trunk/test/Index/targeted-cursor.m Thu Feb 23 19:12:38 2012
@@ -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

Added: cfe/trunk/test/Index/targeted-cursor.m.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/targeted-cursor.m.h?rev=151330&view=auto
==============================================================================
--- cfe/trunk/test/Index/targeted-cursor.m.h (added)
+++ cfe/trunk/test/Index/targeted-cursor.m.h Thu Feb 23 19:12:38 2012
@@ -0,0 +1,7 @@
+
+ at interface I
+
+-(void)mm:(void (^)(I*))block;
+-(void)mm2:(I*)i;
+
+ at end





More information about the cfe-commits mailing list