Add clang-cc option "-analyzer-experimental-checks" to enable experimental path-sensitive checks. The idea is to separate "barely working" or "skunkworks" checks from ones that should always run. Later we need more fine-grain checker control.

llvm-svn: 87053
This commit is contained in:
Ted Kremenek 2009-11-13 01:15:47 +00:00
parent 1e886ebe8c
commit aedb7434c8
6 changed files with 39 additions and 5 deletions

View File

@ -50,6 +50,7 @@ void CheckObjCInstMethSignature(const ObjCImplementationDecl *ID,
void CheckObjCUnusedIvar(const ObjCImplementationDecl *D, BugReporter& BR); void CheckObjCUnusedIvar(const ObjCImplementationDecl *D, BugReporter& BR);
void RegisterAppleChecks(GRExprEngine& Eng, const Decl &D); void RegisterAppleChecks(GRExprEngine& Eng, const Decl &D);
void RegisterExperimentalChecks(GRExprEngine &Eng);
void CheckSecuritySyntaxOnly(const Decl *D, BugReporter &BR); void CheckSecuritySyntaxOnly(const Decl *D, BugReporter &BR);

View File

@ -67,6 +67,7 @@ public:
unsigned TrimGraph : 1; unsigned TrimGraph : 1;
unsigned VisualizeEGDot : 1; unsigned VisualizeEGDot : 1;
unsigned VisualizeEGUbi : 1; unsigned VisualizeEGUbi : 1;
unsigned EnableExperimentalChecks : 1;
public: public:
AnalyzerOptions() { AnalyzerOptions() {
@ -77,6 +78,7 @@ public:
TrimGraph = 0; TrimGraph = 0;
VisualizeEGDot = 0; VisualizeEGDot = 0;
VisualizeEGUbi = 0; VisualizeEGUbi = 0;
EnableExperimentalChecks = 0;
} }
}; };

View File

@ -30,6 +30,7 @@ add_clang_library(clangAnalysis
GRBlockCounter.cpp GRBlockCounter.cpp
GRCoreEngine.cpp GRCoreEngine.cpp
GRExprEngine.cpp GRExprEngine.cpp
GRExprEngineExperimentalChecks.cpp
GRExprEngineInternalChecks.cpp GRExprEngineInternalChecks.cpp
GRState.cpp GRState.cpp
LiveVariables.cpp LiveVariables.cpp

View File

@ -0,0 +1,23 @@
//=-- GRExprEngineExperimentalChecks.h ------------------------------*- C++ -*-=
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines functions to instantiate and register experimental
// checks in GRExprEngine.
//
//===----------------------------------------------------------------------===//
#include "GRExprEngineExperimentalChecks.h"
#include "clang/Analysis/LocalCheckers.h"
using namespace clang;
void clang::RegisterExperimentalChecks(GRExprEngine &Eng) {
RegisterPthreadLockChecker(Eng);
}

View File

@ -333,6 +333,8 @@ static void ActionGRExprEngine(AnalysisConsumer &C, AnalysisManager& mgr, Decl *
// automatically register. // automatically register.
RegisterAppleChecks(Eng, *D); RegisterAppleChecks(Eng, *D);
if (C.Opts.EnableExperimentalChecks)
RegisterExperimentalChecks(Eng);
// Set the graph auditor. // Set the graph auditor.
llvm::OwningPtr<ExplodedNode::Auditor> Auditor; llvm::OwningPtr<ExplodedNode::Auditor> Auditor;

View File

@ -81,7 +81,11 @@ AnalyzeAll("analyzer-opt-analyze-headers",
static llvm::cl::opt<bool> static llvm::cl::opt<bool>
AnalyzerDisplayProgress("analyzer-display-progress", AnalyzerDisplayProgress("analyzer-display-progress",
llvm::cl::desc("Emit verbose output about the analyzer's progress.")); llvm::cl::desc("Emit verbose output about the analyzer's progress"));
static llvm::cl::opt<bool>
AnalyzerExperimentalChecks("analyzer-experimental-checks",
llvm::cl::desc("Use experimental path-sensitive checks"));
static llvm::cl::opt<std::string> static llvm::cl::opt<std::string>
AnalyzeSpecificFunction("analyze-function", AnalyzeSpecificFunction("analyze-function",
@ -91,13 +95,13 @@ static llvm::cl::opt<bool>
EagerlyAssume("analyzer-eagerly-assume", EagerlyAssume("analyzer-eagerly-assume",
llvm::cl::init(false), llvm::cl::init(false),
llvm::cl::desc("Eagerly assume the truth/falseness of some " llvm::cl::desc("Eagerly assume the truth/falseness of some "
"symbolic constraints.")); "symbolic constraints"));
static llvm::cl::opt<bool> static llvm::cl::opt<bool>
PurgeDead("analyzer-purge-dead", PurgeDead("analyzer-purge-dead",
llvm::cl::init(true), llvm::cl::init(true),
llvm::cl::desc("Remove dead symbols, bindings, and constraints before" llvm::cl::desc("Remove dead symbols, bindings, and constraints before"
" processing a statement.")); " processing a statement"));
static llvm::cl::opt<bool> static llvm::cl::opt<bool>
TrimGraph("trim-egraph", TrimGraph("trim-egraph",
@ -126,6 +130,7 @@ void clang::InitializeAnalyzerOptions(AnalyzerOptions &Opts) {
Opts.PurgeDead = PurgeDead; Opts.PurgeDead = PurgeDead;
Opts.EagerlyAssume = EagerlyAssume; Opts.EagerlyAssume = EagerlyAssume;
Opts.AnalyzeSpecificFunction = AnalyzeSpecificFunction; Opts.AnalyzeSpecificFunction = AnalyzeSpecificFunction;
Opts.EnableExperimentalChecks = AnalyzerExperimentalChecks;
Opts.TrimGraph = TrimGraph; Opts.TrimGraph = TrimGraph;
} }