summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/CFG.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-01 03:52:47 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-01 03:52:47 +0000
commit1b37951f36ebd296711b0c8050f28346a7d3d615 (patch)
tree74ddaf7fff0ab95915557b76c2d050d6627274d8 /clang/lib/AST/CFG.cpp
parent2ec6e8e2baa4e4c686de780f94bcdc00772efbba (diff)
downloadbcm5719-llvm-1b37951f36ebd296711b0c8050f28346a7d3d615.tar.gz
bcm5719-llvm-1b37951f36ebd296711b0c8050f28346a7d3d615.zip
CFG: For 'if(...) {}' (empty body) construct an empty CFGBlock so that we can
distinguish between the true and false branches for path-sensitive analyses. llvm-svn: 68185
Diffstat (limited to 'clang/lib/AST/CFG.cpp')
-rw-r--r--clang/lib/AST/CFG.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/AST/CFG.cpp b/clang/lib/AST/CFG.cpp
index fc893d5b649..cd07aacbffc 100644
--- a/clang/lib/AST/CFG.cpp
+++ b/clang/lib/AST/CFG.cpp
@@ -605,8 +605,13 @@ CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) {
Block = NULL;
ThenBlock = Visit(Then);
- if (!ThenBlock) // Can occur when the Then body has all NullStmts.
- ThenBlock = sv.get();
+ if (!ThenBlock) {
+ // We can reach here if the "then" body has all NullStmts.
+ // Create an empty block so we can distinguish between true and false
+ // branches in path-sensitive analyses.
+ ThenBlock = createBlock(false);
+ ThenBlock->addSuccessor(sv.get());
+ }
else if (Block)
FinishBlock(ThenBlock);
}
OpenPOWER on IntegriCloud