summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/AnalysisContext.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-08-02 23:46:59 +0000
committerTed Kremenek <kremenek@apple.com>2010-08-02 23:46:59 +0000
commitdc03bd0894c532a91905da3536b0e1b0d2f13339 (patch)
tree534ff5cf88cc1dccf56ea10c1ec5e82dd7168044 /clang/lib/Analysis/AnalysisContext.cpp
parent4a33fa95c014174b03bd56b357d05861e6379a37 (diff)
downloadbcm5719-llvm-dc03bd0894c532a91905da3536b0e1b0d2f13339.tar.gz
bcm5719-llvm-dc03bd0894c532a91905da3536b0e1b0d2f13339.zip
Add 'AnalysisContext::getUnoptimizedCFG()' to allow clients to get access to the original
CFG without any edges pruned out because of trivially solvable conditions (e.g., 'if (0)'). llvm-svn: 110085
Diffstat (limited to 'clang/lib/Analysis/AnalysisContext.cpp')
-rw-r--r--clang/lib/Analysis/AnalysisContext.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Analysis/AnalysisContext.cpp b/clang/lib/Analysis/AnalysisContext.cpp
index 4a7c60d4cc9..ef0a50f98ee 100644
--- a/clang/lib/Analysis/AnalysisContext.cpp
+++ b/clang/lib/Analysis/AnalysisContext.cpp
@@ -55,7 +55,7 @@ const ImplicitParamDecl *AnalysisContext::getSelfDecl() const {
CFG *AnalysisContext::getCFG() {
if (!builtCFG) {
- cfg = CFG::buildCFG(D, getBody(), &D->getASTContext(), AddEHEdges);
+ cfg = CFG::buildCFG(D, getBody(), &D->getASTContext(), true, AddEHEdges);
// Even when the cfg is not successfully built, we don't
// want to try building it again.
builtCFG = true;
@@ -63,6 +63,17 @@ CFG *AnalysisContext::getCFG() {
return cfg;
}
+CFG *AnalysisContext::getUnoptimizedCFG() {
+ if (!builtCompleteCFG) {
+ completeCFG = CFG::buildCFG(D, getBody(), &D->getASTContext(),
+ false, AddEHEdges);
+ // Even when the cfg is not successfully built, we don't
+ // want to try building it again.
+ builtCompleteCFG = true;
+ }
+ return completeCFG;
+}
+
ParentMap &AnalysisContext::getParentMap() {
if (!PM)
PM = new ParentMap(getBody());
@@ -297,6 +308,7 @@ AnalysisContext::getReferencedBlockVars(const BlockDecl *BD) {
AnalysisContext::~AnalysisContext() {
delete cfg;
+ delete completeCFG;
delete liveness;
delete PM;
delete ReferencedBlockVars;
OpenPOWER on IntegriCloud