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:
		
							parent
							
								
									1e886ebe8c
								
							
						
					
					
						commit
						aedb7434c8
					
				| 
						 | 
				
			
			@ -50,6 +50,7 @@ void CheckObjCInstMethSignature(const ObjCImplementationDecl *ID,
 | 
			
		|||
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);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,6 +67,7 @@ public:
 | 
			
		|||
  unsigned TrimGraph : 1;
 | 
			
		||||
  unsigned VisualizeEGDot : 1;
 | 
			
		||||
  unsigned VisualizeEGUbi : 1;
 | 
			
		||||
  unsigned EnableExperimentalChecks : 1;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AnalyzerOptions() {
 | 
			
		||||
| 
						 | 
				
			
			@ -77,6 +78,7 @@ public:
 | 
			
		|||
    TrimGraph = 0;
 | 
			
		||||
    VisualizeEGDot = 0;
 | 
			
		||||
    VisualizeEGUbi = 0;
 | 
			
		||||
    EnableExperimentalChecks = 0;
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,7 @@ add_clang_library(clangAnalysis
 | 
			
		|||
  GRBlockCounter.cpp
 | 
			
		||||
  GRCoreEngine.cpp
 | 
			
		||||
  GRExprEngine.cpp
 | 
			
		||||
  GRExprEngineExperimentalChecks.cpp
 | 
			
		||||
  GRExprEngineInternalChecks.cpp
 | 
			
		||||
  GRState.cpp
 | 
			
		||||
  LiveVariables.cpp
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);  
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -332,7 +332,9 @@ static void ActionGRExprEngine(AnalysisConsumer &C, AnalysisManager& mgr, Decl *
 | 
			
		|||
  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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -78,11 +78,15 @@ static llvm::cl::opt<bool>
 | 
			
		|||
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 @@ static llvm::cl::opt<bool>
 | 
			
		|||
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 @@ void clang::InitializeAnalyzerOptions(AnalyzerOptions &Opts) {
 | 
			
		|||
  Opts.PurgeDead = PurgeDead;
 | 
			
		||||
  Opts.EagerlyAssume = EagerlyAssume;
 | 
			
		||||
  Opts.AnalyzeSpecificFunction = AnalyzeSpecificFunction;
 | 
			
		||||
  Opts.EnableExperimentalChecks = AnalyzerExperimentalChecks;
 | 
			
		||||
  Opts.TrimGraph = TrimGraph;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue