aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFG.cpp
diff options
context:
space:
mode:
authorZhanyong Wan <wan@google.com>2010-11-22 19:32:14 +0000
committerZhanyong Wan <wan@google.com>2010-11-22 19:32:14 +0000
commit36f327c309b1fb6b82f1987190f0be74000b14c1 (patch)
tree1ba943bf20a79b2ead256ae79b220ff83b478048 /lib/Analysis/CFG.cpp
parentada4b32749458644272d90e34e4149c307376e59 (diff)
Stylistic changes to CFG.cpp:
1. "no 'else' after 'return'" -- this is for conformance with the coding standards. 2. move 'else' to the line of the previous '}' -- this is for consistency. Reviewed by kremenek. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119983 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFG.cpp')
-rw-r--r--lib/Analysis/CFG.cpp46
1 files changed, 22 insertions, 24 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp
index c5ac453d4d..4b89a54023 100644
--- a/lib/Analysis/CFG.cpp
+++ b/lib/Analysis/CFG.cpp
@@ -960,8 +960,7 @@ CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B,
if (RHSBlock) {
if (badCFG)
return 0;
- }
- else {
+ } else {
// Create an empty block for cases where the RHS doesn't require
// any explicit statements in the CFG.
RHSBlock = createBlock();
@@ -986,13 +985,15 @@ CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B,
Block = LHSBlock;
return addStmt(B->getLHS());
}
- else if (B->getOpcode() == BO_Comma) { // ,
+
+ if (B->getOpcode() == BO_Comma) { // ,
autoCreateBlock();
AppendStmt(Block, B, asc);
addStmt(B->getRHS());
return addStmt(B->getLHS());
}
- else if (B->isAssignmentOp()) {
+
+ if (B->isAssignmentOp()) {
if (asc.alwaysAdd()) {
autoCreateBlock();
AppendStmt(Block, B, asc);
@@ -1645,13 +1646,13 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) {
if (Stmt* I = F->getInit()) {
Block = createBlock();
return addStmt(I);
- } else {
- // There is no loop initialization. We are thus basically a while loop.
- // NULL out Block to force lazy block construction.
- Block = NULL;
- Succ = EntryConditionBlock;
- return EntryConditionBlock;
}
+
+ // There is no loop initialization. We are thus basically a while loop.
+ // NULL out Block to force lazy block construction.
+ Block = NULL;
+ Succ = EntryConditionBlock;
+ return EntryConditionBlock;
}
CFGBlock *CFGBuilder::VisitMemberExpr(MemberExpr *M, AddStmtChoice asc) {
@@ -2248,8 +2249,7 @@ CFGBlock* CFGBuilder::VisitCaseStmt(CaseStmt* CS) {
if (TopBlock) {
AddSuccessor(LastBlock, CaseBlock);
Succ = TopBlock;
- }
- else {
+ } else {
// This block is now the implicit successor of other blocks.
Succ = CaseBlock;
}
@@ -2581,7 +2581,7 @@ CFGBlock *CFGBuilder::VisitBinaryOperatorForTemporaryDtors(BinaryOperator *E) {
return ConfluenceBlock;
}
- else if (E->isAssignmentOp()) {
+ if (E->isAssignmentOp()) {
// For assignment operator (=) LHS expression is visited
// before RHS expression. For destructors visit them in reverse order.
CFGBlock *RHSBlock = VisitForTemporaryDtors(E->getRHS());
@@ -2792,12 +2792,11 @@ CFG::BlkExprNumTy CFG::getBlkExprNum(const Stmt* S) {
unsigned CFG::getNumBlkExprs() {
if (const BlkExprMapTy* M = reinterpret_cast<const BlkExprMapTy*>(BlkExprMap))
return M->size();
- else {
- // We assume callers interested in the number of BlkExprs will want
- // the map constructed if it doesn't already exist.
- BlkExprMap = (void*) PopulateBlkExprMap(*this);
- return reinterpret_cast<BlkExprMapTy*>(BlkExprMap)->size();
- }
+
+ // We assume callers interested in the number of BlkExprs will want
+ // the map constructed if it doesn't already exist.
+ BlkExprMap = (void*) PopulateBlkExprMap(*this);
+ return reinterpret_cast<BlkExprMapTy*>(BlkExprMap)->size();
}
//===----------------------------------------------------------------------===//
@@ -2859,7 +2858,7 @@ public:
if (DeclStmt* DS = dyn_cast<DeclStmt>(SE.getStmt())) {
DeclMap[DS->getSingleDecl()] = P;
-
+
} else if (IfStmt* IS = dyn_cast<IfStmt>(SE.getStmt())) {
if (VarDecl* VD = IS->getConditionVariable())
DeclMap[VD] = P;
@@ -3053,10 +3052,9 @@ static void print_elem(llvm::raw_ostream &OS, StmtPrinterHelper* Helper,
S->printPretty(OS, Helper, PrintingPolicy(Helper->getLangOpts()));
if (isa<CXXOperatorCallExpr>(S)) {
- OS << " (OperatorCall)";
- }
- else if (isa<CXXBindTemporaryExpr>(S)) {
- OS << " (BindTemporary)";
+ OS << " (OperatorCall)";
+ } else if (isa<CXXBindTemporaryExpr>(S)) {
+ OS << " (BindTemporary)";
}
// Expressions need a newline.