diff options
author | Zhanyong Wan <wan@google.com> | 2010-11-22 08:45:56 +0000 |
---|---|---|
committer | Zhanyong Wan <wan@google.com> | 2010-11-22 08:45:56 +0000 |
commit | 99cae5b67b9711ca260e5b364a878a1a91183632 (patch) | |
tree | 079d2fc4eaa0e7d3ff3c16740fd89d6fe20e2014 /lib | |
parent | 7acb953031bed92c7420aaf1200d6732239e562e (diff) |
Fix PR8419. Reviewed by kremenek and xuzhongxing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/CFG.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index b58e9826d3..c5ac453d4d 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -296,6 +296,7 @@ private: CFGBlock *VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E, AddStmtChoice asc); CFGBlock *VisitStmtExpr(StmtExpr *S, AddStmtChoice asc); CFGBlock *VisitSwitchStmt(SwitchStmt *S); + CFGBlock *VisitUnaryOperator(UnaryOperator *U, AddStmtChoice asc); CFGBlock *VisitWhileStmt(WhileStmt *W); CFGBlock *Visit(Stmt *S, AddStmtChoice asc = AddStmtChoice::NotAlwaysAdd); @@ -886,6 +887,9 @@ tryAgain: case Stmt::SwitchStmtClass: return VisitSwitchStmt(cast<SwitchStmt>(S)); + case Stmt::UnaryOperatorClass: + return VisitUnaryOperator(cast<UnaryOperator>(S), asc); + case Stmt::WhileStmtClass: return VisitWhileStmt(cast<WhileStmt>(S)); } @@ -922,6 +926,19 @@ CFGBlock *CFGBuilder::VisitAddrLabelExpr(AddrLabelExpr *A, return Block; } +CFGBlock *CFGBuilder::VisitUnaryOperator(UnaryOperator *U, + AddStmtChoice asc) { + if (asc.alwaysAdd()) { + autoCreateBlock(); + AppendStmt(Block, U, asc); + } + + bool asLVal = U->isIncrementDecrementOp(); + return Visit(U->getSubExpr(), + asLVal ? AddStmtChoice::AsLValueNotAlwaysAdd : + AddStmtChoice::NotAlwaysAdd); +} + CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B, AddStmtChoice asc) { if (B->isLogicalOp()) { // && or || |