Skip to content
Snippets Groups Projects
Commit eb94113b authored by Ted Kremenek's avatar Ted Kremenek
Browse files

Add clang-cc option "-analyzer-experimental-checks" to enable experimental...

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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87053 91177308-0d34-0410-b5e6-96231b3b80d8
parent 21dac5e2
No related branches found
No related tags found
No related merge requests found
...@@ -50,6 +50,7 @@ void CheckObjCInstMethSignature(const ObjCImplementationDecl *ID, ...@@ -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);
......
...@@ -67,6 +67,7 @@ public: ...@@ -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: ...@@ -77,6 +78,7 @@ public:
TrimGraph = 0; TrimGraph = 0;
VisualizeEGDot = 0; VisualizeEGDot = 0;
VisualizeEGUbi = 0; VisualizeEGUbi = 0;
EnableExperimentalChecks = 0;
} }
}; };
......
...@@ -30,6 +30,7 @@ add_clang_library(clangAnalysis ...@@ -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
......
//=-- 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);
}
...@@ -332,7 +332,9 @@ static void ActionGRExprEngine(AnalysisConsumer &C, AnalysisManager& mgr, Decl * ...@@ -332,7 +332,9 @@ static void ActionGRExprEngine(AnalysisConsumer &C, AnalysisManager& mgr, Decl *
Eng.RegisterInternalChecks(); // FIXME: Internal checks should just Eng.RegisterInternalChecks(); // FIXME: Internal checks should just
// 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;
......
...@@ -78,11 +78,15 @@ static llvm::cl::opt<bool> ...@@ -78,11 +78,15 @@ static llvm::cl::opt<bool>
AnalyzeAll("analyzer-opt-analyze-headers", AnalyzeAll("analyzer-opt-analyze-headers",
llvm::cl::desc("Force the static analyzer to analyze " llvm::cl::desc("Force the static analyzer to analyze "
"functions defined in header files")); "functions defined in header files"));
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",
llvm::cl::desc("Run analysis on specific function")); llvm::cl::desc("Run analysis on specific function"));
...@@ -91,13 +95,13 @@ static llvm::cl::opt<bool> ...@@ -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) { ...@@ -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;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment