diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-04-01 03:52:47 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-04-01 03:52:47 +0000 |
commit | dbdf7949a7a50f5a65055a3e95f6432ecc541056 (patch) | |
tree | 421d5af9eb7de9cdd04d7156ad7e6436d1385b6b | |
parent | bb71b392729b86858ee861b967006a03c07c41f2 (diff) |
CFG: For 'if(...) {}' (empty body) construct an empty CFGBlock so that we can
distinguish between the true and false branches for path-sensitive analyses.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68185 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/CFG.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/AST/CFG.cpp b/lib/AST/CFG.cpp index fc893d5b64..cd07aacbff 100644 --- a/lib/AST/CFG.cpp +++ b/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); } |