forked from OSchip/llvm-project
[analyzer] Run the ExprEngine depending on the CheckerManager having path-sensitive checkers.
llvm-svn: 126674
This commit is contained in:
parent
20f5caa518
commit
6a1c760760
|
@ -97,6 +97,8 @@ public:
|
||||||
CheckerManager(const LangOptions &langOpts) : LangOpts(langOpts) { }
|
CheckerManager(const LangOptions &langOpts) : LangOpts(langOpts) { }
|
||||||
~CheckerManager();
|
~CheckerManager();
|
||||||
|
|
||||||
|
bool hasPathSensitiveCheckers() const;
|
||||||
|
|
||||||
void finishedCheckerRegistration();
|
void finishedCheckerRegistration();
|
||||||
|
|
||||||
const LangOptions &getLangOptions() const { return LangOpts; }
|
const LangOptions &getLangOptions() const { return LangOpts; }
|
||||||
|
|
|
@ -20,6 +20,22 @@
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
using namespace ento;
|
using namespace ento;
|
||||||
|
|
||||||
|
bool CheckerManager::hasPathSensitiveCheckers() const {
|
||||||
|
return !StmtCheckers.empty() ||
|
||||||
|
!PreObjCMessageCheckers.empty() ||
|
||||||
|
!PostObjCMessageCheckers.empty() ||
|
||||||
|
!LocationCheckers.empty() ||
|
||||||
|
!BindCheckers.empty() ||
|
||||||
|
!EndAnalysisCheckers.empty() ||
|
||||||
|
!EndPathCheckers.empty() ||
|
||||||
|
!BranchConditionCheckers.empty() ||
|
||||||
|
!LiveSymbolsCheckers.empty() ||
|
||||||
|
!DeadSymbolsCheckers.empty() ||
|
||||||
|
!RegionChangesCheckers.empty() ||
|
||||||
|
!EvalAssumeCheckers.empty() ||
|
||||||
|
!EvalCallCheckers.empty();
|
||||||
|
}
|
||||||
|
|
||||||
void CheckerManager::finishedCheckerRegistration() {
|
void CheckerManager::finishedCheckerRegistration() {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// Make sure that for every event that has listeners, there is at least
|
// Make sure that for every event that has listeners, there is at least
|
||||||
|
|
|
@ -278,6 +278,9 @@ static void FindBlocks(DeclContext *D, llvm::SmallVectorImpl<Decl*> &WL) {
|
||||||
FindBlocks(DC, WL);
|
FindBlocks(DC, WL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ActionObjCMemChecker(AnalysisConsumer &C, AnalysisManager& mgr,
|
||||||
|
Decl *D);
|
||||||
|
|
||||||
void AnalysisConsumer::HandleCode(Decl *D, Actions& actions) {
|
void AnalysisConsumer::HandleCode(Decl *D, Actions& actions) {
|
||||||
|
|
||||||
// Don't run the actions if an error has occured with parsing the file.
|
// Don't run the actions if an error has occured with parsing the file.
|
||||||
|
@ -305,17 +308,15 @@ void AnalysisConsumer::HandleCode(Decl *D, Actions& actions) {
|
||||||
BugReporter BR(*Mgr);
|
BugReporter BR(*Mgr);
|
||||||
for (llvm::SmallVectorImpl<Decl*>::iterator WI=WL.begin(), WE=WL.end();
|
for (llvm::SmallVectorImpl<Decl*>::iterator WI=WL.begin(), WE=WL.end();
|
||||||
WI != WE; ++WI)
|
WI != WE; ++WI)
|
||||||
if ((*WI)->hasBody())
|
if ((*WI)->hasBody()) {
|
||||||
checkerMgr->runCheckersOnASTBody(*WI, *Mgr, BR);
|
checkerMgr->runCheckersOnASTBody(*WI, *Mgr, BR);
|
||||||
|
if (checkerMgr->hasPathSensitiveCheckers())
|
||||||
for (Actions::iterator I = actions.begin(), E = actions.end(); I != E; ++I)
|
ActionObjCMemChecker(*this, *Mgr, *WI);
|
||||||
for (llvm::SmallVectorImpl<Decl*>::iterator WI=WL.begin(), WE=WL.end();
|
}
|
||||||
WI != WE; ++WI)
|
|
||||||
(*I)(*this, *Mgr, *WI);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Analyses
|
// Path-sensitive checking.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
static void ActionExprEngine(AnalysisConsumer &C, AnalysisManager& mgr,
|
static void ActionExprEngine(AnalysisConsumer &C, AnalysisManager& mgr,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s -Wno-implicit-function-declaration
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s -Wno-implicit-function-declaration
|
||||||
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s -Wno-implicit-function-declaration
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s -Wno-implicit-function-declaration
|
||||||
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify -fobjc-gc -disable-free %s -Wno-implicit-function-declaration
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify -fobjc-gc -disable-free %s -Wno-implicit-function-declaration
|
||||||
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s -Wno-implicit-function-declaration
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s -Wno-implicit-function-declaration
|
||||||
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s -Wno-implicit-function-declaration
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s -Wno-implicit-function-declaration
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// The following code is reduced using delta-debugging from
|
// The following code is reduced using delta-debugging from
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify %s
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -analyzer-constraints=basic -verify %s
|
||||||
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify %s
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -analyzer-constraints=range -verify %s
|
||||||
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=basic -verify %s
|
||||||
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-constraints=range -verify %s
|
||||||
|
|
||||||
typedef struct CGColorSpace *CGColorSpaceRef;
|
typedef struct CGColorSpace *CGColorSpaceRef;
|
||||||
extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void);
|
extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=basic -verify %s
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=basic -verify %s
|
||||||
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -verify %s
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem -analyzer-store=region -verify %s
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
|
||||||
|
|
||||||
typedef signed char BOOL;
|
typedef signed char BOOL;
|
||||||
typedef unsigned int NSUInteger;
|
typedef unsigned int NSUInteger;
|
||||||
|
|
Loading…
Reference in New Issue