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 | 245adabd97c8c770c13935a9075f2243cc6f1d57 (patch) | |
tree | abd01e8a0c55aba1aada82bd5925104b060f6472 /lib/Analysis/AnalysisContext.cpp | |
parent | 5e1e89b8af283af34943a477dc6378f1a641df26 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111426 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/AnalysisContext.cpp')
-rw-r--r-- | lib/Analysis/AnalysisContext.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Analysis/AnalysisContext.cpp b/lib/Analysis/AnalysisContext.cpp index ced4f1dd2e..934a031b3a 100644 --- a/lib/Analysis/AnalysisContext.cpp +++ b/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; } |