[cfe-dev] Clang Static Analyzer Inline

Artem Dergachev via cfe-dev cfe-dev at lists.llvm.org
Fri Jul 7 03:14:35 PDT 2017


There may be various reasons why the analyzer doesn't inline the 
function; this option allows inlining of allocation calls, but the 
function may fail to be inlined for a different reason. The logic is 
complicated and is mostly concentrated in ExprEngine::defaultEvalCall() 
and ExprEngine::shouldInlineCall() and a few surrounding functions. 
Whenever i badly want to know why is or isn't a certain function not 
inlined, i just sit in this code under a debugger and see why he does it.

I do not remember the current status of C++ allocation functions, but it 
might be that they're explicitly disabled because of some weird false 
positives in other checkers, that we didn't have time to fix.

Generally, though, you should not rely on any function being inlined 
when making a checker, because we'd never be able to inline all 
functions. For example, we may skip inlining because the function's body 
looks too complex. The checker should ideally work safely even when 
inlining is completely disabled.


On 7/4/17 2:34 PM, Xin Wang via cfe-dev wrote:
> Hello everyone!
>
> I am writing a checker to explore the constructor and the destructor. 
> It seems that the analyzer doesn't inline the new operator like/A *a = 
> new A();. /So I set /c++-allocator-inlining /to be true which I think 
> will let the analyzer inline the constructor, but it didn't work. Can 
> anyone explain this?
>
> Look forward to your help!
>
> Regards,
> Xin
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list