diff options
author | Tom Care <tom.care@uqconnect.edu.au> | 2010-08-18 21:17:24 +0000 |
---|---|---|
committer | Tom Care <tom.care@uqconnect.edu.au> | 2010-08-18 21:17:24 +0000 |
commit | b9933f365eefb3b6bd026ce9ed297c336d889e78 (patch) | |
tree | 5a23d87be4ddfde14c9e651825e3a2acc043d13f /clang/lib/Analysis/AnalysisContext.cpp | |
parent | 80d19f0905b6a375d837b71e5d78674dd6080e5b (diff) | |
download | bcm5719-llvm-b9933f365eefb3b6bd026ce9ed297c336d889e78.tar.gz bcm5719-llvm-b9933f365eefb3b6bd026ce9ed297c336d889e78.zip |
Added psuedo-constant analysis and integrated it into the false positive reduction stage in IdempotentOperationChecker.
- Renamed IdempotentOperationChecker::isConstant to isConstantOrPseudoConstant to better reflect the function
- Changed IdempotentOperationChecker::PreVisitBinaryOperator to only run 'CanVary' once on undefined assumptions
- Created new PsuedoConstantAnalysis class and added it to AnalysisContext
- Changed IdempotentOperationChecker to exploit the new analysis
- Updated tests with psuedo-constants
- Added check to IdempotentOperationChecker to see if a Decl is const qualified
llvm-svn: 111426
Diffstat (limited to 'clang/lib/Analysis/AnalysisContext.cpp')
-rw-r--r-- | clang/lib/Analysis/AnalysisContext.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Analysis/AnalysisContext.cpp b/clang/lib/Analysis/AnalysisContext.cpp index ced4f1dd2ee..934a031b3ab 100644 --- a/clang/lib/Analysis/AnalysisContext.cpp +++ b/clang/lib/Analysis/AnalysisContext.cpp @@ -18,6 +18,7 @@ #include "clang/AST/ParentMap.h" #include "clang/AST/StmtVisitor.h" #include "clang/Analysis/Analyses/LiveVariables.h" +#include "clang/Analysis/Analyses/PsuedoConstantAnalysis.h" #include "clang/Analysis/AnalysisContext.h" #include "clang/Analysis/CFG.h" #include "clang/Analysis/Support/BumpVector.h" @@ -83,6 +84,12 @@ ParentMap &AnalysisContext::getParentMap() { return *PM; } +PsuedoConstantAnalysis *AnalysisContext::getPsuedoConstantAnalysis() { + if (!PCA) + PCA = new PsuedoConstantAnalysis(getBody()); + return PCA; +} + LiveVariables *AnalysisContext::getLiveVariables() { if (!liveness) { CFG *c = getCFG(); @@ -314,6 +321,7 @@ AnalysisContext::~AnalysisContext() { delete completeCFG; delete liveness; delete PM; + delete PCA; delete ReferencedBlockVars; } |