aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFG.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-01-19 20:52:05 +0000
committerTed Kremenek <kremenek@apple.com>2010-01-19 20:52:05 +0000
commit3fa1e4b27300a4ea4cf273182d4b6427ef87f3f8 (patch)
tree631eb0ca9c6e280e334b180424ea2b1e7037a700 /lib/Analysis/CFG.cpp
parent6db0ad32fa0987ff76d4c41393991ef4b6895ea3 (diff)
Tighten code and rework indentation of some if() branches (for readability). No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFG.cpp')
-rw-r--r--lib/Analysis/CFG.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp
index e1ddc3de6d..21c241848a 100644
--- a/lib/Analysis/CFG.cpp
+++ b/lib/Analysis/CFG.cpp
@@ -1579,10 +1579,7 @@ CFGBlock *CFGBuilder::VisitCXXTryStmt(CXXTryStmt *Terminator) {
// up to the try.
assert(Terminator->getTryBlock() && "try must contain a non-NULL body");
Block = NULL;
- CFGBlock *BodyBlock = addStmt(Terminator->getTryBlock());
-
- Block = BodyBlock;
-
+ Block = addStmt(Terminator->getTryBlock());
return Block;
}
@@ -1741,9 +1738,7 @@ CFG::BlkExprNumTy CFG::getBlkExprNum(const Stmt* S) {
BlkExprMapTy* M = reinterpret_cast<BlkExprMapTy*>(BlkExprMap);
BlkExprMapTy::iterator I = M->find(S);
-
- if (I == M->end()) return CFG::BlkExprNumTy();
- else return CFG::BlkExprNumTy(I->second);
+ return (I == M->end()) ? CFG::BlkExprNumTy() : CFG::BlkExprNumTy(I->second);
}
unsigned CFG::getNumBlkExprs() {
@@ -1772,7 +1767,6 @@ CFG::~CFG() {
namespace {
class StmtPrinterHelper : public PrinterHelper {
-
typedef llvm::DenseMap<Stmt*,std::pair<unsigned,unsigned> > StmtMapTy;
StmtMapTy StmtMap;
signed CurrentBlock;
@@ -1804,10 +1798,11 @@ public:
return false;
if (CurrentBlock >= 0 && I->second.first == (unsigned) CurrentBlock
- && I->second.second == CurrentStmt)
+ && I->second.second == CurrentStmt) {
return false;
+ }
- OS << "[B" << I->second.first << "." << I->second.second << "]";
+ OS << "[B" << I->second.first << "." << I->second.second << "]";
return true;
}
};
@@ -1821,7 +1816,6 @@ class CFGBlockTerminatorPrint
llvm::raw_ostream& OS;
StmtPrinterHelper* Helper;
PrintingPolicy Policy;
-
public:
CFGBlockTerminatorPrint(llvm::raw_ostream& os, StmtPrinterHelper* helper,
const PrintingPolicy &Policy)
@@ -1839,22 +1833,27 @@ public:
void VisitForStmt(ForStmt* F) {
OS << "for (" ;
- if (F->getInit()) OS << "...";
+ if (F->getInit())
+ OS << "...";
OS << "; ";
- if (Stmt* C = F->getCond()) C->printPretty(OS, Helper, Policy);
+ if (Stmt* C = F->getCond())
+ C->printPretty(OS, Helper, Policy);
OS << "; ";
- if (F->getInc()) OS << "...";
+ if (F->getInc())
+ OS << "...";
OS << ")";
}
void VisitWhileStmt(WhileStmt* W) {
OS << "while " ;
- if (Stmt* C = W->getCond()) C->printPretty(OS, Helper, Policy);
+ if (Stmt* C = W->getCond())
+ C->printPretty(OS, Helper, Policy);
}
void VisitDoStmt(DoStmt* D) {
OS << "do ... while ";
- if (Stmt* C = D->getCond()) C->printPretty(OS, Helper, Policy);
+ if (Stmt* C = D->getCond())
+ C->printPretty(OS, Helper, Policy);
}
void VisitSwitchStmt(SwitchStmt* Terminator) {