[cfe-commits] r68185 - /cfe/trunk/lib/AST/CFG.cpp
Ted Kremenek
kremenek at apple.com
Tue Mar 31 20:52:48 PDT 2009
Author: kremenek
Date: Tue Mar 31 22:52:47 2009
New Revision: 68185
URL: http://llvm.org/viewvc/llvm-project?rev=68185&view=rev
Log:
CFG: For 'if(...) {}' (empty body) construct an empty CFGBlock so that we can
distinguish between the true and false branches for path-sensitive analyses.
Modified:
cfe/trunk/lib/AST/CFG.cpp
Modified: cfe/trunk/lib/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CFG.cpp?rev=68185&r1=68184&r2=68185&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CFG.cpp (original)
+++ cfe/trunk/lib/AST/CFG.cpp Tue Mar 31 22:52:47 2009
@@ -605,8 +605,13 @@
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);
}
More information about the cfe-commits
mailing list