diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-04-29 01:10:26 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-04-29 01:10:26 +0000 |
commit | 989da5eeff9a1052ec253b4d509f3b552b0802b6 (patch) | |
tree | 06c0cebfc43bbe12e84d563b9f35cf7a8d9f35b3 /clang/lib/Analysis/CFG.cpp | |
parent | f4336ebb2ab6374bc03901e4a78555fc7978f3ad (diff) | |
download | bcm5719-llvm-989da5eeff9a1052ec253b4d509f3b552b0802b6.tar.gz bcm5719-llvm-989da5eeff9a1052ec253b4d509f3b552b0802b6.zip |
Fix CFG crasher involving statement expressions reported in PR 6938.
llvm-svn: 102576
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r-- | clang/lib/Analysis/CFG.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index e447657e9ef..7c7504a1d82 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -498,8 +498,16 @@ CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B, Succ = ConfluenceBlock; Block = NULL; CFGBlock* RHSBlock = addStmt(B->getRHS()); - if (!FinishBlock(RHSBlock)) - return 0; + + if (RHSBlock) { + if (!FinishBlock(RHSBlock)) + return 0; + } + else { + // Create an empty block for cases where the RHS doesn't require + // any explicit statements in the CFG. + RHSBlock = createBlock(); + } // See if this is a known constant. TryResult KnownVal = TryEvaluateBool(B->getLHS()); |