[cfe-commits] r151848 - in /cfe/trunk: include/clang/Frontend/AnalyzerOptions.h lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp test/Analysis/misc-ps-region-store.m

Anna Zaks ganna at apple.com
Fri Mar 2 15:02:56 PST 2012


As of r151930, you can use -analyzer-inline-stack-depth=0 or -analyzer-inline-max-function-size=0 as a hack to disable it for testing purposes. However, all the committed code should work with inlining turned on.

I'll commit a proper solution soon. My understanding is that this is not blocking anyone.

Cheers,
Anna.
On Mar 2, 2012, at 2:20 PM, Tom Care wrote:

> Perhaps for the moment we could have --analyzer-disable-inlining?
> 
> Tom
> 
> On 02/03/2012, at 6:33 PM, Anna Zaks wrote:
> 
>> Jordy, 
>> 
>> Currently, there is none. This commit was primarily done so that we could better test inlining asap. We are still deciding what command line options should be provided to better regulate this. We are currently experimenting with different ways of  tuning inlining, which might have some influence on the decision..
>> 
>> One possibility would be to have the following low level options:
>> 
>> -analyzer-ipa=[none | inline | future_work_goes_here]
>> 
>> Then, all the inlining specific options would be enabled only when inlining is selected:
>> -analyzer-inline-stack-depth=#
>> -analyzer-inline-max-function-size=#
>> ..
>> 
>> These could be further mapped to high level analyzes depth settings given to the user (of scan-build):
>> -analyzes-depth=[fast | normal | deep]
>> 
>> Suggestions are welcome,
>> Anna.
>> On Mar 2, 2012, at 1:22 AM, Jordy Rose wrote:
>> 
>>> How do you turn /off/ inlining? Where does Opts.InlineCall get set to 0?
>>> 
>>> Jordy
>>> 
>>> 
>>> On Mar 2, 2012, at 5:37, Anna Zaks wrote:
>>> 
>>>> Author: zaks
>>>> Date: Thu Mar  1 16:37:46 2012
>>>> New Revision: 151848
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=151848&view=rev
>>>> Log:
>>>> [analyzer] Turn inlining on by default for better testing exposure.
>>>> 
>>>> Fix a test, which was most likely an unintended recursive call.
>>>> 
>>>> Modified:
>>>> cfe/trunk/include/clang/Frontend/AnalyzerOptions.h
>>>> cfe/trunk/lib/Driver/Tools.cpp
>>>> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>>>> cfe/trunk/test/Analysis/misc-ps-region-store.m
>>>> 
>>>> Modified: cfe/trunk/include/clang/Frontend/AnalyzerOptions.h
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/AnalyzerOptions.h?rev=151848&r1=151847&r2=151848&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/include/clang/Frontend/AnalyzerOptions.h (original)
>>>> +++ cfe/trunk/include/clang/Frontend/AnalyzerOptions.h Thu Mar  1 16:37:46 2012
>>>> @@ -100,7 +100,7 @@
>>>>  TrimGraph = 0;
>>>>  VisualizeEGDot = 0;
>>>>  VisualizeEGUbi = 0;
>>>> -    InlineCall = 0;
>>>> +    InlineCall = 1;
>>>>  UnoptimizedCFG = 0;
>>>>  CFGAddImplicitDtors = 0;
>>>>  CFGAddInitializers = 0;
>>>> 
>>>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=151848&r1=151847&r2=151848&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>>>> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Mar  1 16:37:46 2012
>>>> @@ -1339,6 +1339,8 @@
>>>> 
>>>>  CmdArgs.push_back("-analyzer-eagerly-assume");
>>>> 
>>>> +    CmdArgs.push_back("-analyzer-inline-call");
>>>> +
>>>>  // Add default argument set.
>>>>  if (!Args.hasArg(options::OPT__analyzer_no_default_checks)) {
>>>>    CmdArgs.push_back("-analyzer-checker=core");
>>>> 
>>>> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=151848&r1=151847&r2=151848&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
>>>> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Mar  1 16:37:46 2012
>>>> @@ -1044,7 +1044,8 @@
>>>> Opts.MaxNodes = Args.getLastArgIntValue(OPT_analyzer_max_nodes, 150000,Diags);
>>>> Opts.MaxLoop = Args.getLastArgIntValue(OPT_analyzer_max_loop, 4, Diags);
>>>> Opts.EagerlyTrimEGraph = !Args.hasArg(OPT_analyzer_no_eagerly_trim_egraph);
>>>> -  Opts.InlineCall = Args.hasArg(OPT_analyzer_inline_call);
>>>> +  if (Args.hasArg(OPT_analyzer_inline_call))
>>>> +    Opts.InlineCall = 1;
>>>> Opts.PrintStats = Args.hasArg(OPT_analyzer_stats);
>>>> 
>>>> Opts.CheckersControlList.clear();
>>>> 
>>>> Modified: cfe/trunk/test/Analysis/misc-ps-region-store.m
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/misc-ps-region-store.m?rev=151848&r1=151847&r2=151848&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/test/Analysis/misc-ps-region-store.m (original)
>>>> +++ cfe/trunk/test/Analysis/misc-ps-region-store.m Thu Mar  1 16:37:46 2012
>>>> @@ -294,9 +294,11 @@
>>>> struct ArrayWrapper { unsigned char y[16]; };
>>>> struct WrappedStruct { unsigned z; };
>>>> 
>>>> +void test_handle_array_wrapper_helper();
>>>> +
>>>> int test_handle_array_wrapper() {
>>>> struct ArrayWrapper x;
>>>> -  test_handle_array_wrapper(&x);
>>>> +  test_handle_array_wrapper_helper(&x);
>>>> struct WrappedStruct *p = (struct WrappedStruct*) x.y; // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption.}}
>>>> return p->z;  // no-warning
>>>> }
>>>> 
>>>> 
>>>> _______________________________________________
>>>> 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