зеркало из https://github.com/microsoft/clang-1.git
[analyzer] Enable retry exhausted without inlining by default.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153591 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
fb02784df0
Коммит
b47dbcbc12
|
@ -99,8 +99,8 @@ def analyzer_inlining_mode : Separate<"-analyzer-inlining-mode">,
|
|||
HelpText<"Specify the function selection heuristic used during inlining">;
|
||||
def analyzer_inlining_mode_EQ : Joined<"-analyzer-inlining-mode=">, Alias<analyzer_inlining_mode>;
|
||||
|
||||
def analyzer_retry_exhausted : Flag<"-analyzer-retry-exhausted">,
|
||||
HelpText<"Re-analyze paths leading to exhausted nodes with a different strategy for better code coverage">;
|
||||
def analyzer_disable_retry_exhausted : Flag<"-analyzer-disable-retry-exhausted">,
|
||||
HelpText<"Do not re-analyze paths leading to exhausted nodes with a different strategy (may decrease code coverage)">;
|
||||
|
||||
def analyzer_max_nodes : Separate<"-analyzer-max-nodes">,
|
||||
HelpText<"The maximum number of nodes the analyzer can generate (150000 default, 0 = no limit)">;
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
unsigned CFGAddInitializers : 1;
|
||||
unsigned EagerlyTrimEGraph : 1;
|
||||
unsigned PrintStats : 1;
|
||||
unsigned RetryExhausted : 1;
|
||||
unsigned NoRetryExhausted : 1;
|
||||
unsigned InlineMaxStackDepth;
|
||||
unsigned InlineMaxFunctionSize;
|
||||
AnalysisInliningMode InliningMode;
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
CFGAddInitializers = 0;
|
||||
EagerlyTrimEGraph = 0;
|
||||
PrintStats = 0;
|
||||
RetryExhausted = 0;
|
||||
NoRetryExhausted = 0;
|
||||
// Cap the stack depth at 4 calls (5 stack frames, base + 4 calls).
|
||||
InlineMaxStackDepth = 5;
|
||||
InlineMaxFunctionSize = 200;
|
||||
|
|
|
@ -91,9 +91,9 @@ public:
|
|||
/// \brief The mode of function selection used during inlining.
|
||||
AnalysisInliningMode InliningMode;
|
||||
|
||||
/// \brief Re-analyze paths leading to exhausted nodes with a different
|
||||
/// strategy for better code coverage.
|
||||
bool RetryExhausted;
|
||||
/// \brief Do not re-analyze paths leading to exhausted nodes with a different
|
||||
/// strategy. We get better code coverage when retry is enabled.
|
||||
bool NoRetryExhausted;
|
||||
|
||||
public:
|
||||
AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags,
|
||||
|
@ -112,7 +112,7 @@ public:
|
|||
unsigned inlineMaxStack,
|
||||
unsigned inlineMaxFunctionSize,
|
||||
AnalysisInliningMode inliningMode,
|
||||
bool retry);
|
||||
bool NoRetry);
|
||||
|
||||
/// Construct a clone of the given AnalysisManager with the given ASTContext
|
||||
/// and DiagnosticsEngine.
|
||||
|
|
|
@ -167,8 +167,8 @@ static void AnalyzerOptsToArgs(const AnalyzerOptions &Opts, ToArgsList &Res) {
|
|||
Res.push_back("-analyzer-viz-egraph-graphviz");
|
||||
if (Opts.VisualizeEGUbi)
|
||||
Res.push_back("-analyzer-viz-egraph-ubigraph");
|
||||
if (Opts.RetryExhausted)
|
||||
Res.push_back("-analyzer-retry-exhausted");
|
||||
if (Opts.NoRetryExhausted)
|
||||
Res.push_back("-analyzer-disable-retry-exhausted");
|
||||
|
||||
for (unsigned i = 0, e = Opts.CheckersControlList.size(); i != e; ++i) {
|
||||
const std::pair<std::string, bool> &opt = Opts.CheckersControlList[i];
|
||||
|
@ -1016,7 +1016,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
|
|||
Opts.ShowCheckerHelp = Args.hasArg(OPT_analyzer_checker_help);
|
||||
Opts.VisualizeEGDot = Args.hasArg(OPT_analyzer_viz_egraph_graphviz);
|
||||
Opts.VisualizeEGUbi = Args.hasArg(OPT_analyzer_viz_egraph_ubigraph);
|
||||
Opts.RetryExhausted = Args.hasArg(OPT_analyzer_retry_exhausted);
|
||||
Opts.NoRetryExhausted = Args.hasArg(OPT_analyzer_disable_retry_exhausted);
|
||||
Opts.AnalyzeAll = Args.hasArg(OPT_analyzer_opt_analyze_headers);
|
||||
Opts.AnalyzerDisplayProgress = Args.hasArg(OPT_analyzer_display_progress);
|
||||
Opts.AnalyzeNestedBlocks =
|
||||
|
|
|
@ -34,7 +34,7 @@ AnalysisManager::AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags,
|
|||
unsigned inlineMaxStack,
|
||||
unsigned inlineMaxFunctionSize,
|
||||
AnalysisInliningMode IMode,
|
||||
bool retry)
|
||||
bool NoRetry)
|
||||
: AnaCtxMgr(useUnoptimizedCFG, addImplicitDtors, addInitializers),
|
||||
Ctx(ctx), Diags(diags), LangOpts(lang), PD(pd),
|
||||
CreateStoreMgr(storemgr), CreateConstraintMgr(constraintmgr),
|
||||
|
@ -47,7 +47,7 @@ AnalysisManager::AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags,
|
|||
InlineMaxStackDepth(inlineMaxStack),
|
||||
InlineMaxFunctionSize(inlineMaxFunctionSize),
|
||||
InliningMode(IMode),
|
||||
RetryExhausted(retry)
|
||||
NoRetryExhausted(NoRetry)
|
||||
{
|
||||
AnaCtxMgr.getCFGBuildOptions().setAllAlwaysAdd();
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ AnalysisManager::AnalysisManager(ASTContext &ctx, DiagnosticsEngine &diags,
|
|||
InlineMaxStackDepth(ParentAM.InlineMaxStackDepth),
|
||||
InlineMaxFunctionSize(ParentAM.InlineMaxFunctionSize),
|
||||
InliningMode(ParentAM.InliningMode),
|
||||
RetryExhausted(ParentAM.RetryExhausted)
|
||||
NoRetryExhausted(ParentAM.NoRetryExhausted)
|
||||
{
|
||||
AnaCtxMgr.getCFGBuildOptions().setAllAlwaysAdd();
|
||||
}
|
||||
|
|
|
@ -1053,7 +1053,7 @@ void ExprEngine::processCFGBlockEntrance(const BlockEdge &L,
|
|||
// no-inlining policy in the state and enqueuing the new work item on
|
||||
// the list. Replay should almost never fail. Use the stats to catch it
|
||||
// if it does.
|
||||
if ((AMgr.RetryExhausted && replayWithoutInlining(pred, CalleeLC)))
|
||||
if ((!AMgr.NoRetryExhausted && replayWithoutInlining(pred, CalleeLC)))
|
||||
return;
|
||||
NumMaxBlockCountReachedInInlined++;
|
||||
} else
|
||||
|
|
|
@ -204,7 +204,7 @@ public:
|
|||
Opts.InlineMaxStackDepth,
|
||||
Opts.InlineMaxFunctionSize,
|
||||
Opts.InliningMode,
|
||||
Opts.RetryExhausted));
|
||||
Opts.NoRetryExhausted));
|
||||
}
|
||||
|
||||
virtual void HandleTranslationUnit(ASTContext &C);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc -analyzer-store=region -analyzer-max-loop 4 -analyzer-retry-exhausted -verify %s
|
||||
// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc -analyzer-store=region -analyzer-max-loop 4 -verify %s
|
||||
#include "system-header-simulator.h"
|
||||
|
||||
typedef __typeof(sizeof(int)) size_t;
|
||||
|
|
Загрузка…
Ссылка в новой задаче