[cfe-commits] r54013 - /cfe/trunk/lib/Parse/ParseObjc.cpp

Steve Naroff snaroff at apple.com
Fri Jul 25 10:14:14 PDT 2008


On Jul 25, 2008, at 12:46 PM, Chris Lattner wrote:

>
> On Jul 25, 2008, at 7:30 AM, Steve Naroff wrote:
>
>> Author: snaroff
>> Date: Fri Jul 25 09:30:25 2008
>> New Revision: 54013
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=54013&view=rev
>> Log:
>> Fix Parser::ParseObjCMethodDefinition(). Only call the actions  
>> module for valid MDecl's.
>
> Steve, I don't think this is the right fix.  An actions  
> implementation is currently allowed to return null pointers for the  
> opaque decl object.  What are you fixing here?
>

The following...

+ (void)addObject {
}

...would cause clang to crash.

The action assumes a non-null MDecl.

I don't know what you mean by an opaque decl object. Can you give me  
an example?

Thanks,

snaroff

> -Chris
>
>>
>>
>> Modified:
>>   cfe/trunk/lib/Parse/ParseObjc.cpp
>>
>> Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=54013&r1=54012&r2=54013&view=diff
>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
>> +++ cfe/trunk/lib/Parse/ParseObjc.cpp Fri Jul 25 09:30:25 2008
>> @@ -1292,8 +1292,10 @@
>>  EnterScope(Scope::FnScope|Scope::DeclScope);
>>
>>  // Tell the actions module that we have entered a method  
>> definition with the
>> -  // specified Declarator for the method.
>> -  Actions.ObjCActOnStartOfMethodDef(CurScope, MDecl);
>> +  // specified Declarator for the method. If we don't have an  
>> MDecl, avoid
>> +  // calling the actions module.
>> +  if (MDecl)
>> +    Actions.ObjCActOnStartOfMethodDef(CurScope, MDecl);
>>
>>  StmtResult FnBody = ParseCompoundStatementBody();
>>
>> @@ -1305,7 +1307,8 @@
>>  ExitScope();
>>
>>  // TODO: Pass argument information.
>> -  Actions.ActOnFinishFunctionBody(MDecl, FnBody.Val);
>> +  if (MDecl)
>> +    Actions.ActOnFinishFunctionBody(MDecl, FnBody.Val);
>>  return MDecl;
>> }
>>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list