[cfe-commits] r147306 - /cfe/trunk/lib/Analysis/CFG.cpp

Xu Zhongxing xu_zhong_xing at 163.com
Thu Dec 29 03:26:25 PST 2011


Hi Ted,

This change itself does not fix (1) or (2). But in my experimental 
implementation, I have CXXConstructExpr not be always constructed as 
block-level expr. So I could see the context of a CXXConstructExpr being 
called, e.g., as a variable's initializer. (I haven't seen all the cases.)

On the other hand, if we see the CXXConstructExpr first as a block-level 
expr, we cannot know its calling context.

This is surely not the final solution. But it's a step I want to try. We 
can discuss it.


于 2011/12/29 13:59, Ted Kremenek 写道:
> Hi Zhongxing,
>
> I don't understand how this is actually fixing (1) or (2).  Can you explain?  We're moving to a place where we will likely linearize the entire CFG (this is already the case for the static analyzer), so it would be great to find a solution to (1) or (2) that doesn't depend on whether or not CXXConstructExpr is a block-level expression.
>
> Thanks,
> Ted
>
> On Dec 27, 2011, at 8:38 PM, Zhongxing Xu wrote:
>
>> Author: zhongxingxu
>> Date: Tue Dec 27 22:38:46 2011
>> New Revision: 147306
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=147306&view=rev
>> Log:
>> Enable the user to control whether CXXConstructExpr will be added as a
>> block-level expr. Currently CXXConstructExpr is always added as a block-level
>> expr. This caused two problems for the analyzer (and potentially for the
>> CFG-based codegen).
>> 1. We have no way to know whether a ctor call is base or complete.
>> 2. We have no way to know the destination object being contructed.
>>
>> Modified:
>>    cfe/trunk/lib/Analysis/CFG.cpp
>>
>> Modified: cfe/trunk/lib/Analysis/CFG.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=147306&r1=147305&r2=147306&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Analysis/CFG.cpp (original)
>> +++ cfe/trunk/lib/Analysis/CFG.cpp Tue Dec 27 22:38:46 2011
>> @@ -2768,7 +2768,7 @@
>> CFGBlock *CFGBuilder::VisitCXXConstructExpr(CXXConstructExpr *C,
>>                                             AddStmtChoice asc) {
>>   autoCreateBlock();
>> -  if (!C->isElidable())
>> +  if (!C->isElidable()&&  asc.alwaysAdd(*this, C))
>>     appendStmt(Block, C);
>>
>>   return VisitChildren(C);
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> _______________________________________________
> 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