[cfe-commits] r87053 - in /cfe/trunk: include/clang/Analysis/LocalCheckers.h include/clang/Frontend/AnalysisConsumer.h lib/Analysis/CMakeLists.txt lib/Analysis/GRExprEngineExperimentalChecks.cpp lib/Frontend/AnalysisConsumer.cpp tools/clang-cc/Options.cpp
Ted Kremenek
kremenek at apple.com
Thu Nov 12 17:15:48 PST 2009
Author: kremenek
Date: Thu Nov 12 19:15:47 2009
New Revision: 87053
URL: http://llvm.org/viewvc/llvm-project?rev=87053&view=rev
Log:
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.
Added:
cfe/trunk/lib/Analysis/GRExprEngineExperimentalChecks.cpp
Modified:
cfe/trunk/include/clang/Analysis/LocalCheckers.h
cfe/trunk/include/clang/Frontend/AnalysisConsumer.h
cfe/trunk/lib/Analysis/CMakeLists.txt
cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
cfe/trunk/tools/clang-cc/Options.cpp
Modified: cfe/trunk/include/clang/Analysis/LocalCheckers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/LocalCheckers.h?rev=87053&r1=87052&r2=87053&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/LocalCheckers.h (original)
+++ cfe/trunk/include/clang/Analysis/LocalCheckers.h Thu Nov 12 19:15:47 2009
@@ -50,6 +50,7 @@
void CheckObjCUnusedIvar(const ObjCImplementationDecl *D, BugReporter& BR);
void RegisterAppleChecks(GRExprEngine& Eng, const Decl &D);
+void RegisterExperimentalChecks(GRExprEngine &Eng);
void CheckSecuritySyntaxOnly(const Decl *D, BugReporter &BR);
Modified: cfe/trunk/include/clang/Frontend/AnalysisConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/AnalysisConsumer.h?rev=87053&r1=87052&r2=87053&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/AnalysisConsumer.h (original)
+++ cfe/trunk/include/clang/Frontend/AnalysisConsumer.h Thu Nov 12 19:15:47 2009
@@ -67,6 +67,7 @@
unsigned TrimGraph : 1;
unsigned VisualizeEGDot : 1;
unsigned VisualizeEGUbi : 1;
+ unsigned EnableExperimentalChecks : 1;
public:
AnalyzerOptions() {
@@ -77,6 +78,7 @@
TrimGraph = 0;
VisualizeEGDot = 0;
VisualizeEGUbi = 0;
+ EnableExperimentalChecks = 0;
}
};
Modified: cfe/trunk/lib/Analysis/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CMakeLists.txt?rev=87053&r1=87052&r2=87053&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CMakeLists.txt (original)
+++ cfe/trunk/lib/Analysis/CMakeLists.txt Thu Nov 12 19:15:47 2009
@@ -30,6 +30,7 @@
GRBlockCounter.cpp
GRCoreEngine.cpp
GRExprEngine.cpp
+ GRExprEngineExperimentalChecks.cpp
GRExprEngineInternalChecks.cpp
GRState.cpp
LiveVariables.cpp
Added: cfe/trunk/lib/Analysis/GRExprEngineExperimentalChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngineExperimentalChecks.cpp?rev=87053&view=auto
==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngineExperimentalChecks.cpp (added)
+++ cfe/trunk/lib/Analysis/GRExprEngineExperimentalChecks.cpp Thu Nov 12 19:15:47 2009
@@ -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);
+}
+
Modified: cfe/trunk/lib/Frontend/AnalysisConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/AnalysisConsumer.cpp?rev=87053&r1=87052&r2=87053&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/AnalysisConsumer.cpp (original)
+++ cfe/trunk/lib/Frontend/AnalysisConsumer.cpp Thu Nov 12 19:15:47 2009
@@ -332,7 +332,9 @@
Eng.RegisterInternalChecks(); // FIXME: Internal checks should just
// automatically register.
RegisterAppleChecks(Eng, *D);
-
+
+ if (C.Opts.EnableExperimentalChecks)
+ RegisterExperimentalChecks(Eng);
// Set the graph auditor.
llvm::OwningPtr<ExplodedNode::Auditor> Auditor;
Modified: cfe/trunk/tools/clang-cc/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/Options.cpp?rev=87053&r1=87052&r2=87053&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/Options.cpp (original)
+++ cfe/trunk/tools/clang-cc/Options.cpp Thu Nov 12 19:15:47 2009
@@ -78,11 +78,15 @@
AnalyzeAll("analyzer-opt-analyze-headers",
llvm::cl::desc("Force the static analyzer to analyze "
"functions defined in header files"));
-
+
static llvm::cl::opt<bool>
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>
AnalyzeSpecificFunction("analyze-function",
llvm::cl::desc("Run analysis on specific function"));
@@ -91,13 +95,13 @@
EagerlyAssume("analyzer-eagerly-assume",
llvm::cl::init(false),
llvm::cl::desc("Eagerly assume the truth/falseness of some "
- "symbolic constraints."));
+ "symbolic constraints"));
static llvm::cl::opt<bool>
PurgeDead("analyzer-purge-dead",
llvm::cl::init(true),
llvm::cl::desc("Remove dead symbols, bindings, and constraints before"
- " processing a statement."));
+ " processing a statement"));
static llvm::cl::opt<bool>
TrimGraph("trim-egraph",
@@ -126,6 +130,7 @@
Opts.PurgeDead = PurgeDead;
Opts.EagerlyAssume = EagerlyAssume;
Opts.AnalyzeSpecificFunction = AnalyzeSpecificFunction;
+ Opts.EnableExperimentalChecks = AnalyzerExperimentalChecks;
Opts.TrimGraph = TrimGraph;
}
More information about the cfe-commits
mailing list