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

Argyrios Kyrtzidis kyrtzidis at apple.com
Fri Feb 24 11:27:35 PST 2012


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));

> 
> 
> 	- Doug




More information about the cfe-commits mailing list