On Feb 24, 2012, at 11:27 AM, Argyrios Kyrtzidis <[email protected]> wrote:
> On Feb 24, 2012, at 10:27 AM, Douglas Gregor wrote: > >> >> On Feb 23, 2012, at 5:12 PM, Argyrios Kyrtzidis wrote: >> >>> 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; >> >> This FIXME isn't really true. ParmVarDecls that are part of a function type >> (but not a FunctionDecl) have translation unit context, e.g., >> >> typedef int func(int x, int y); > > Ok, but ParmVarDecls that are part of a function type of a parameter of a > function/objc method, should not have TU context, e.g: > > void foo(void (*fp)(int x)); Personally, I think it's a simpler invariant to say that a ParmVarDecl is owned by a FunctionDecl, an ObjCMethodDecl, or the TU… and nothing else. - Doug _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
