[cfe-commits] r151330 - in /cfe/trunk: lib/Serialization/ASTWriter.cpp test/Index/targeted-cursor.m test/Index/targeted-cursor.m.h
dgregor at apple.com
Fri Feb 24 13:32:39 CST 2012
On Feb 24, 2012, at 11:27 AM, Argyrios Kyrtzidis <kyrtzidis at apple.com> 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
>>> [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.
>>> 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())
>>> + // 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.
More information about the cfe-commits