aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/AnalysisContext.cpp2
-rw-r--r--lib/Analysis/CFG.cpp320
-rw-r--r--lib/Analysis/LiveVariables.cpp6
-rw-r--r--lib/Analysis/PseudoConstantAnalysis.cpp2
-rw-r--r--lib/Analysis/UninitializedValues.cpp10
5 files changed, 170 insertions, 170 deletions
diff --git a/lib/Analysis/AnalysisContext.cpp b/lib/Analysis/AnalysisContext.cpp
index 5a85899389..7078e799b6 100644
--- a/lib/Analysis/AnalysisContext.cpp
+++ b/lib/Analysis/AnalysisContext.cpp
@@ -204,7 +204,7 @@ void LocationContext::ProfileCommon(llvm::FoldingSetNodeID &ID,
ContextKind ck,
AnalysisContext *ctx,
const LocationContext *parent,
- const void* data) {
+ const void *data) {
ID.AddInteger(ck);
ID.AddPointer(ctx);
ID.AddPointer(parent);
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp
index 1edb328d01..31a2931e1c 100644
--- a/lib/Analysis/CFG.cpp
+++ b/lib/Analysis/CFG.cpp
@@ -29,9 +29,9 @@ using namespace clang;
namespace {
-static SourceLocation GetEndLoc(Decl* D) {
- if (VarDecl* VD = dyn_cast<VarDecl>(D))
- if (Expr* Ex = VD->getInit())
+static SourceLocation GetEndLoc(Decl *D) {
+ if (VarDecl *VD = dyn_cast<VarDecl>(D))
+ if (Expr *Ex = VD->getInit())
return Ex->getSourceRange().getEnd();
return D->getLocation();
}
@@ -121,16 +121,16 @@ public:
*this = Scope->Prev;
}
- VarDecl* const* operator->() const {
+ VarDecl *const* operator->() const {
assert (Scope && "Dereferencing invalid iterator is not allowed");
assert (VarIter != 0 && "Iterator has invalid value of VarIter member");
return &Scope->Vars[VarIter - 1];
}
- VarDecl* operator*() const {
+ VarDecl *operator*() const {
return *this->operator->();
}
- const_iterator& operator++() {
+ const_iterator &operator++() {
if (!Scope)
return *this;
@@ -146,10 +146,10 @@ public:
return P;
}
- bool operator==(const const_iterator& rhs) const {
+ bool operator==(const const_iterator &rhs) const {
return Scope == rhs.Scope && VarIter == rhs.VarIter;
}
- bool operator!=(const const_iterator& rhs) const {
+ bool operator!=(const const_iterator &rhs) const {
return !(*this == rhs);
}
@@ -179,7 +179,7 @@ public:
/// Begin of scope in direction of CFG building (backwards).
const_iterator begin() const { return const_iterator(*this, Vars.size()); }
- void addVar(VarDecl* VD) {
+ void addVar(VarDecl *VD) {
Vars.push_back(VD, ctx);
}
};
@@ -205,7 +205,7 @@ int LocalScope::const_iterator::distance(LocalScope::const_iterator L) {
/// and LocalScope::const_iterator that specifies position in LocalScope graph.
struct BlockScopePosPair {
BlockScopePosPair() : block(0) {}
- BlockScopePosPair(CFGBlock* b, LocalScope::const_iterator scopePos)
+ BlockScopePosPair(CFGBlock *b, LocalScope::const_iterator scopePos)
: block(b), scopePosition(scopePos) {}
CFGBlock *block;
@@ -252,13 +252,13 @@ class CFGBuilder {
ASTContext *Context;
llvm::OwningPtr<CFG> cfg;
- CFGBlock* Block;
- CFGBlock* Succ;
+ CFGBlock *Block;
+ CFGBlock *Succ;
JumpTarget ContinueJumpTarget;
JumpTarget BreakJumpTarget;
- CFGBlock* SwitchTerminatedBlock;
- CFGBlock* DefaultCaseBlock;
- CFGBlock* TryTerminatedBlock;
+ CFGBlock *SwitchTerminatedBlock;
+ CFGBlock *DefaultCaseBlock;
+ CFGBlock *TryTerminatedBlock;
// Current position in local scope.
LocalScope::const_iterator ScopePos;
@@ -305,7 +305,7 @@ private:
// Visitors to walk an AST and construct the CFG.
CFGBlock *VisitAddrLabelExpr(AddrLabelExpr *A, AddStmtChoice asc);
CFGBlock *VisitBinaryOperator(BinaryOperator *B, AddStmtChoice asc);
- CFGBlock *VisitBlockExpr(BlockExpr* E, AddStmtChoice asc);
+ CFGBlock *VisitBlockExpr(BlockExpr *E, AddStmtChoice asc);
CFGBlock *VisitBreakStmt(BreakStmt *B);
CFGBlock *VisitCXXCatchStmt(CXXCatchStmt *S);
CFGBlock *VisitExprWithCleanups(ExprWithCleanups *E,
@@ -328,11 +328,11 @@ private:
AddStmtChoice asc);
CFGBlock *VisitContinueStmt(ContinueStmt *C);
CFGBlock *VisitDeclStmt(DeclStmt *DS);
- CFGBlock *VisitDeclSubExpr(DeclStmt* DS);
+ CFGBlock *VisitDeclSubExpr(DeclStmt *DS);
CFGBlock *VisitDefaultStmt(DefaultStmt *D);
CFGBlock *VisitDoStmt(DoStmt *D);
CFGBlock *VisitForStmt(ForStmt *F);
- CFGBlock *VisitGotoStmt(GotoStmt* G);
+ CFGBlock *VisitGotoStmt(GotoStmt *G);
CFGBlock *VisitIfStmt(IfStmt *I);
CFGBlock *VisitImplicitCastExpr(ImplicitCastExpr *E, AddStmtChoice asc);
CFGBlock *VisitIndirectGotoStmt(IndirectGotoStmt *I);
@@ -343,7 +343,7 @@ private:
CFGBlock *VisitObjCAtThrowStmt(ObjCAtThrowStmt *S);
CFGBlock *VisitObjCAtTryStmt(ObjCAtTryStmt *S);
CFGBlock *VisitObjCForCollectionStmt(ObjCForCollectionStmt *S);
- CFGBlock *VisitReturnStmt(ReturnStmt* R);
+ CFGBlock *VisitReturnStmt(ReturnStmt *R);
CFGBlock *VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E,
AddStmtChoice asc);
CFGBlock *VisitStmtExpr(StmtExpr *S, AddStmtChoice asc);
@@ -353,7 +353,7 @@ private:
CFGBlock *Visit(Stmt *S, AddStmtChoice asc = AddStmtChoice::NotAlwaysAdd);
CFGBlock *VisitStmt(Stmt *S, AddStmtChoice asc);
- CFGBlock *VisitChildren(Stmt* S);
+ CFGBlock *VisitChildren(Stmt *S);
// Visitors to walk an AST and generate destructors of temporaries in
// full expression.
@@ -367,7 +367,7 @@ private:
bool BindToTemporary);
// NYS == Not Yet Supported
- CFGBlock* NYS() {
+ CFGBlock *NYS() {
badCFG = true;
return Block;
}
@@ -380,17 +380,17 @@ private:
}
CFGBlock *addInitializer(CXXCtorInitializer *I);
void addAutomaticObjDtors(LocalScope::const_iterator B,
- LocalScope::const_iterator E, Stmt* S);
+ LocalScope::const_iterator E, Stmt *S);
void addImplicitDtorsForDestructor(const CXXDestructorDecl *DD);
// Local scopes creation.
LocalScope* createOrReuseLocalScope(LocalScope* Scope);
- void addLocalScopeForStmt(Stmt* S);
- LocalScope* addLocalScopeForDeclStmt(DeclStmt* DS, LocalScope* Scope = NULL);
- LocalScope* addLocalScopeForVarDecl(VarDecl* VD, LocalScope* Scope = NULL);
+ void addLocalScopeForStmt(Stmt *S);
+ LocalScope* addLocalScopeForDeclStmt(DeclStmt *DS, LocalScope* Scope = NULL);
+ LocalScope* addLocalScopeForVarDecl(VarDecl *VD, LocalScope* Scope = NULL);
- void addLocalScopeAndDtors(Stmt* S);
+ void addLocalScopeAndDtors(Stmt *S);
// Interface to CFGBlock - adding CFGElements.
void appendStmt(CFGBlock *B, const Stmt *S) {
@@ -414,11 +414,11 @@ private:
B->appendTemporaryDtor(E, cfg->getBumpVectorContext());
}
- void insertAutomaticObjDtors(CFGBlock* Blk, CFGBlock::iterator I,
- LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt* S);
- void appendAutomaticObjDtors(CFGBlock* Blk, LocalScope::const_iterator B,
- LocalScope::const_iterator E, Stmt* S);
- void prependAutomaticObjDtorsWithTerminator(CFGBlock* Blk,
+ void insertAutomaticObjDtors(CFGBlock *Blk, CFGBlock::iterator I,
+ LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt *S);
+ void appendAutomaticObjDtors(CFGBlock *Blk, LocalScope::const_iterator B,
+ LocalScope::const_iterator E, Stmt *S);
+ void prependAutomaticObjDtorsWithTerminator(CFGBlock *Blk,
LocalScope::const_iterator B, LocalScope::const_iterator E);
void addSuccessor(CFGBlock *B, CFGBlock *S) {
@@ -514,7 +514,7 @@ static const VariableArrayType *FindVA(const Type *t) {
/// body (compound statement). The ownership of the returned CFG is
/// transferred to the caller. If CFG construction fails, this method returns
/// NULL.
-CFG* CFGBuilder::buildCFG(const Decl *D, Stmt* Statement) {
+CFG* CFGBuilder::buildCFG(const Decl *D, Stmt *Statement) {
assert(cfg.get());
if (!Statement)
return NULL;
@@ -554,8 +554,8 @@ CFG* CFGBuilder::buildCFG(const Decl *D, Stmt* Statement) {
for (BackpatchBlocksTy::iterator I = BackpatchBlocks.begin(),
E = BackpatchBlocks.end(); I != E; ++I ) {
- CFGBlock* B = I->block;
- GotoStmt* G = cast<GotoStmt>(B->getTerminator());
+ CFGBlock *B = I->block;
+ GotoStmt *G = cast<GotoStmt>(B->getTerminator());
LabelMapTy::iterator LI = LabelMap.find(G->getLabel());
// If there is no target for the goto, then we are looking at an
@@ -569,7 +569,7 @@ CFG* CFGBuilder::buildCFG(const Decl *D, Stmt* Statement) {
}
// Add successors to the Indirect Goto Dispatch block (if we have one).
- if (CFGBlock* B = cfg->getIndirectGotoBlock())
+ if (CFGBlock *B = cfg->getIndirectGotoBlock())
for (LabelSetTy::iterator I = AddressTakenLabels.begin(),
E = AddressTakenLabels.end(); I != E; ++I ) {
@@ -591,8 +591,8 @@ CFG* CFGBuilder::buildCFG(const Decl *D, Stmt* Statement) {
/// createBlock - Used to lazily create blocks that are connected
/// to the current (global) succcessor.
-CFGBlock* CFGBuilder::createBlock(bool add_successor) {
- CFGBlock* B = cfg->createBlock();
+CFGBlock *CFGBuilder::createBlock(bool add_successor) {
+ CFGBlock *B = cfg->createBlock();
if (add_successor && Succ)
addSuccessor(B, Succ);
return B;
@@ -640,7 +640,7 @@ CFGBlock *CFGBuilder::addInitializer(CXXCtorInitializer *I) {
/// for objects in range of local scope positions. Use S as trigger statement
/// for destructors.
void CFGBuilder::addAutomaticObjDtors(LocalScope::const_iterator B,
- LocalScope::const_iterator E, Stmt* S) {
+ LocalScope::const_iterator E, Stmt *S) {
if (!BuildOpts.AddImplicitDtors)
return;
@@ -713,7 +713,7 @@ LocalScope* CFGBuilder::createOrReuseLocalScope(LocalScope* Scope) {
/// addLocalScopeForStmt - Add LocalScope to local scopes tree for statement
/// that should create implicit scope (e.g. if/else substatements).
-void CFGBuilder::addLocalScopeForStmt(Stmt* S) {
+void CFGBuilder::addLocalScopeForStmt(Stmt *S) {
if (!BuildOpts.AddImplicitDtors)
return;
@@ -742,14 +742,14 @@ void CFGBuilder::addLocalScopeForStmt(Stmt* S) {
/// addLocalScopeForDeclStmt - Add LocalScope for declaration statement. Will
/// reuse Scope if not NULL.
-LocalScope* CFGBuilder::addLocalScopeForDeclStmt(DeclStmt* DS,
+LocalScope* CFGBuilder::addLocalScopeForDeclStmt(DeclStmt *DS,
LocalScope* Scope) {
if (!BuildOpts.AddImplicitDtors)
return Scope;
for (DeclStmt::decl_iterator DI = DS->decl_begin(), DE = DS->decl_end()
; DI != DE; ++DI) {
- if (VarDecl* VD = dyn_cast<VarDecl>(*DI))
+ if (VarDecl *VD = dyn_cast<VarDecl>(*DI))
Scope = addLocalScopeForVarDecl(VD, Scope);
}
return Scope;
@@ -758,7 +758,7 @@ LocalScope* CFGBuilder::addLocalScopeForDeclStmt(DeclStmt* DS,
/// addLocalScopeForVarDecl - Add LocalScope for variable declaration. It will
/// create add scope for automatic objects and temporary objects bound to
/// const reference. Will reuse Scope if not NULL.
-LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl* VD,
+LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl *VD,
LocalScope* Scope) {
if (!BuildOpts.AddImplicitDtors)
return Scope;
@@ -790,7 +790,7 @@ LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl* VD,
}
// Check if type is a C++ class with non-trivial destructor.
- if (const CXXRecordDecl* CD = QT->getAsCXXRecordDecl())
+ if (const CXXRecordDecl *CD = QT->getAsCXXRecordDecl())
if (!CD->hasTrivialDestructor()) {
// Add the variable to scope
Scope = createOrReuseLocalScope(Scope);
@@ -802,7 +802,7 @@ LocalScope* CFGBuilder::addLocalScopeForVarDecl(VarDecl* VD,
/// addLocalScopeAndDtors - For given statement add local scope for it and
/// add destructors that will cleanup the scope. Will reuse Scope if not NULL.
-void CFGBuilder::addLocalScopeAndDtors(Stmt* S) {
+void CFGBuilder::addLocalScopeAndDtors(Stmt *S) {
if (!BuildOpts.AddImplicitDtors)
return;
@@ -814,9 +814,9 @@ void CFGBuilder::addLocalScopeAndDtors(Stmt* S) {
/// insertAutomaticObjDtors - Insert destructor CFGElements for variables with
/// automatic storage duration to CFGBlock's elements vector. Insertion will be
/// performed in place specified with iterator.
-void CFGBuilder::insertAutomaticObjDtors(CFGBlock* Blk, CFGBlock::iterator I,
- LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt* S) {
- BumpVectorContext& C = cfg->getBumpVectorContext();
+void CFGBuilder::insertAutomaticObjDtors(CFGBlock *Blk, CFGBlock::iterator I,
+ LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt *S) {
+ BumpVectorContext &C = cfg->getBumpVectorContext();
I = Blk->beginAutomaticObjDtorsInsert(I, B.distance(E), C);
while (B != E)
I = Blk->insertAutomaticObjDtor(I, *B++, S);
@@ -826,8 +826,8 @@ void CFGBuilder::insertAutomaticObjDtors(CFGBlock* Blk, CFGBlock::iterator I,
/// automatic storage duration to CFGBlock's elements vector. Elements will be
/// appended to physical end of the vector which happens to be logical
/// beginning.
-void CFGBuilder::appendAutomaticObjDtors(CFGBlock* Blk,
- LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt* S) {
+void CFGBuilder::appendAutomaticObjDtors(CFGBlock *Blk,
+ LocalScope::const_iterator B, LocalScope::const_iterator E, Stmt *S) {
insertAutomaticObjDtors(Blk, Blk->begin(), B, E, S);
}
@@ -836,7 +836,7 @@ void CFGBuilder::appendAutomaticObjDtors(CFGBlock* Blk,
/// Elements will be prepended to physical beginning of the vector which
/// happens to be logical end. Use blocks terminator as statement that specifies
/// destructors call site.
-void CFGBuilder::prependAutomaticObjDtorsWithTerminator(CFGBlock* Blk,
+void CFGBuilder::prependAutomaticObjDtorsWithTerminator(CFGBlock *Blk,
LocalScope::const_iterator B, LocalScope::const_iterator E) {
insertAutomaticObjDtors(Blk, Blk->end(), B, E, Blk->getTerminator());
}
@@ -844,7 +844,7 @@ void CFGBuilder::prependAutomaticObjDtorsWithTerminator(CFGBlock* Blk,
/// Visit - Walk the subtree of a statement and add extra
/// blocks for ternary operators, &&, and ||. We also process "," and
/// DeclStmts (which may contain nested control-flow).
-CFGBlock* CFGBuilder::Visit(Stmt * S, AddStmtChoice asc) {
+CFGBlock *CFGBuilder::Visit(Stmt * S, AddStmtChoice asc) {
if (!S) {
badCFG = true;
return 0;
@@ -998,7 +998,7 @@ CFGBlock *CFGBuilder::VisitStmt(Stmt *S, AddStmtChoice asc) {
}
/// VisitChildren - Visit the children of a Stmt.
-CFGBlock *CFGBuilder::VisitChildren(Stmt* Terminator) {
+CFGBlock *CFGBuilder::VisitChildren(Stmt *Terminator) {
CFGBlock *lastBlock = Block;
for (Stmt::child_range I = Terminator->children(); I; ++I)
if (Stmt *child = *I)
@@ -1033,20 +1033,20 @@ CFGBlock *CFGBuilder::VisitUnaryOperator(UnaryOperator *U,
CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B,
AddStmtChoice asc) {
if (B->isLogicalOp()) { // && or ||
- CFGBlock* ConfluenceBlock = Block ? Block : createBlock();
+ CFGBlock *ConfluenceBlock = Block ? Block : createBlock();
appendStmt(ConfluenceBlock, B);
if (badCFG)
return 0;
// create the block evaluating the LHS
- CFGBlock* LHSBlock = createBlock(false);
+ CFGBlock *LHSBlock = createBlock(false);
LHSBlock->setTerminator(B);
// create the block evaluating the RHS
Succ = ConfluenceBlock;
Block = NULL;
- CFGBlock* RHSBlock = addStmt(B->getRHS());
+ CFGBlock *RHSBlock = addStmt(B->getRHS());
if (RHSBlock) {
if (badCFG)
@@ -1213,7 +1213,7 @@ CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, AddStmtChoice asc) {
CFGBlock *CFGBuilder::VisitChooseExpr(ChooseExpr *C,
AddStmtChoice asc) {
- CFGBlock* ConfluenceBlock = Block ? Block : createBlock();
+ CFGBlock *ConfluenceBlock = Block ? Block : createBlock();
appendStmt(ConfluenceBlock, C);
if (badCFG)
return 0;
@@ -1221,13 +1221,13 @@ CFGBlock *CFGBuilder::VisitChooseExpr(ChooseExpr *C,
AddStmtChoice alwaysAdd = asc.withAlwaysAdd(true);
Succ = ConfluenceBlock;
Block = NULL;
- CFGBlock* LHSBlock = Visit(C->getLHS(), alwaysAdd);
+ CFGBlock *LHSBlock = Visit(C->getLHS(), alwaysAdd);
if (badCFG)
return 0;
Succ = ConfluenceBlock;
Block = NULL;
- CFGBlock* RHSBlock = Visit(C->getRHS(), alwaysAdd);
+ CFGBlock *RHSBlock = Visit(C->getRHS(), alwaysAdd);
if (badCFG)
return 0;
@@ -1241,9 +1241,9 @@ CFGBlock *CFGBuilder::VisitChooseExpr(ChooseExpr *C,
}
-CFGBlock* CFGBuilder::VisitCompoundStmt(CompoundStmt* C) {
+CFGBlock *CFGBuilder::VisitCompoundStmt(CompoundStmt *C) {
addLocalScopeAndDtors(C);
- CFGBlock* LastBlock = Block;
+ CFGBlock *LastBlock = Block;
for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), E=C->body_rend();
I != E; ++I ) {
@@ -1266,7 +1266,7 @@ CFGBlock *CFGBuilder::VisitConditionalOperator(AbstractConditionalOperator *C,
// Create the confluence block that will "merge" the results of the ternary
// expression.
- CFGBlock* ConfluenceBlock = Block ? Block : createBlock();
+ CFGBlock *ConfluenceBlock = Block ? Block : createBlock();
appendStmt(ConfluenceBlock, C);
if (badCFG)
return 0;
@@ -1279,7 +1279,7 @@ CFGBlock *CFGBuilder::VisitConditionalOperator(AbstractConditionalOperator *C,
// e.g: x ?: y is shorthand for: x ? x : y;
Succ = ConfluenceBlock;
Block = NULL;
- CFGBlock* LHSBlock = 0;
+ CFGBlock *LHSBlock = 0;
const Expr *trueExpr = C->getTrueExpr();
if (trueExpr != opaqueValue) {
LHSBlock = Visit(C->getTrueExpr(), alwaysAdd);
@@ -1292,7 +1292,7 @@ CFGBlock *CFGBuilder::VisitConditionalOperator(AbstractConditionalOperator *C,
// Create the block for the RHS expression.
Succ = ConfluenceBlock;
- CFGBlock* RHSBlock = Visit(C->getFalseExpr(), alwaysAdd);
+ CFGBlock *RHSBlock = Visit(C->getFalseExpr(), alwaysAdd);
if (badCFG)
return 0;
@@ -1357,7 +1357,7 @@ CFGBlock *CFGBuilder::VisitDeclStmt(DeclStmt *DS) {
/// VisitDeclSubExpr - Utility method to add block-level expressions for
/// DeclStmts and initializers in them.
-CFGBlock *CFGBuilder::VisitDeclSubExpr(DeclStmt* DS) {
+CFGBlock *CFGBuilder::VisitDeclSubExpr(DeclStmt *DS) {
assert(DS->isSingleDecl() && "Can handle single declarations only.");
Decl *D = DS->getSingleDecl();
@@ -1416,7 +1416,7 @@ CFGBlock *CFGBuilder::VisitDeclSubExpr(DeclStmt* DS) {
return Block;
}
-CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) {
+CFGBlock *CFGBuilder::VisitIfStmt(IfStmt *I) {
// We may see an if statement in the middle of a basic block, or it may be the
// first statement we are processing. In either case, we create a new basic
// block. First, we create the blocks for the then...else statements, and
@@ -1430,7 +1430,7 @@ CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) {
// Create local scope for possible condition variable.
// Store scope position. Add implicit destructor.
- if (VarDecl* VD = I->getConditionVariable()) {
+ if (VarDecl *VD = I->getConditionVariable()) {
LocalScope::const_iterator BeginScopePos = ScopePos;
addLocalScopeForVarDecl(VD);
addAutomaticObjDtors(ScopePos, BeginScopePos, I);
@@ -1445,9 +1445,9 @@ CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) {
}
// Process the false branch.
- CFGBlock* ElseBlock = Succ;
+ CFGBlock *ElseBlock = Succ;
- if (Stmt* Else = I->getElse()) {
+ if (Stmt *Else = I->getElse()) {
SaveAndRestore<CFGBlock*> sv(Succ);
// NULL out Block so that the recursive call to Visit will
@@ -1470,9 +1470,9 @@ CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) {
}
// Process the true branch.
- CFGBlock* ThenBlock;
+ CFGBlock *ThenBlock;
{
- Stmt* Then = I->getThen();
+ Stmt *Then = I->getThen();
assert(Then);
SaveAndRestore<CFGBlock*> sv(Succ);
Block = NULL;
@@ -1528,7 +1528,7 @@ CFGBlock* CFGBuilder::VisitIfStmt(IfStmt* I) {
}
-CFGBlock* CFGBuilder::VisitReturnStmt(ReturnStmt* R) {
+CFGBlock *CFGBuilder::VisitReturnStmt(ReturnStmt *R) {
// If we were in the middle of a block we stop processing that block.
//
// NOTE: If a "return" appears in the middle of a block, this means that the
@@ -1548,7 +1548,7 @@ CFGBlock* CFGBuilder::VisitReturnStmt(ReturnStmt* R) {
return VisitStmt(R, AddStmtChoice::AlwaysAdd);
}
-CFGBlock* CFGBuilder::VisitLabelStmt(LabelStmt *L) {
+CFGBlock *CFGBuilder::VisitLabelStmt(LabelStmt *L) {
// Get the block of the labeled statement. Add it to our map.
addStmt(L->getSubStmt());
CFGBlock *LabelBlock = Block;
@@ -1577,7 +1577,7 @@ CFGBlock* CFGBuilder::VisitLabelStmt(LabelStmt *L) {
return LabelBlock;
}
-CFGBlock* CFGBuilder::VisitGotoStmt(GotoStmt* G) {
+CFGBlock *CFGBuilder::VisitGotoStmt(GotoStmt *G) {
// Goto is a control-flow statement. Thus we stop processing the current
// block and create a new one.
@@ -1599,8 +1599,8 @@ CFGBlock* CFGBuilder::VisitGotoStmt(GotoStmt* G) {
return Block;
}
-CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) {
- CFGBlock* LoopSuccessor = NULL;
+CFGBlock *CFGBuilder::VisitForStmt(ForStmt *F) {
+ CFGBlock *LoopSuccessor = NULL;
// Save local scope position because in case of condition variable ScopePos
// won't be restored when traversing AST.
@@ -1609,11 +1609,11 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) {
// Create local scope for init statement and possible condition variable.
// Add destructor for init statement and condition variable.
// Store scope position for continue statement.
- if (Stmt* Init = F->getInit())
+ if (Stmt *Init = F->getInit())
addLocalScopeForStmt(Init);
LocalScope::const_iterator LoopBeginScopePos = ScopePos;
- if (VarDecl* VD = F->getConditionVariable())
+ if (VarDecl *VD = F->getConditionVariable())
addLocalScopeForVarDecl(VD);
LocalScope::const_iterator ContinueScopePos = ScopePos;
@@ -1636,15 +1636,15 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) {
// Because of short-circuit evaluation, the condition of the loop can span
// multiple basic blocks. Thus we need the "Entry" and "Exit" blocks that
// evaluate the condition.
- CFGBlock* ExitConditionBlock = createBlock(false);
- CFGBlock* EntryConditionBlock = ExitConditionBlock;
+ CFGBlock *ExitConditionBlock = createBlock(false);
+ CFGBlock *EntryConditionBlock = ExitConditionBlock;
// Set the terminator for the "exit" condition block.
ExitConditionBlock->setTerminator(F);
// Now add the actual condition to the condition block. Because the condition
// itself may contain control-flow, new blocks may be created.
- if (Stmt* C = F->getCond()) {
+ if (Stmt *C = F->getCond()) {
Block = ExitConditionBlock;
EntryConditionBlock = addStmt(C);
if (badCFG)
@@ -1693,7 +1693,7 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) {
// Loop body should end with destructor of Condition variable (if any).
addAutomaticObjDtors(ScopePos, LoopBeginScopePos, F);
- if (Stmt* I = F->getInc()) {
+ if (Stmt *I = F->getInc()) {
// Generate increment code in its own basic block. This is the target of
// continue statements.
Succ = addStmt(I);
@@ -1725,7 +1725,7 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) {
// Now populate the body block, and in the process create new blocks as we
// walk the body of the loop.
- CFGBlock* BodyBlock = addStmt(F->getBody());
+ CFGBlock *BodyBlock = addStmt(F->getBody());
if (!BodyBlock)
BodyBlock = ContinueJumpTarget.block;//can happen for "for (...;...;...);"
@@ -1742,7 +1742,7 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) {
// If the loop contains initialization, create a new block for those
// statements. This block can also contain statements that precede the loop.
- if (Stmt* I = F->getInit()) {
+ if (Stmt *I = F->getInit()) {
Block = createBlock();
return addStmt(I);
}
@@ -1762,7 +1762,7 @@ CFGBlock *CFGBuilder::VisitMemberExpr(MemberExpr *M, AddStmtChoice asc) {
return Visit(M->getBase());
}
-CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
+CFGBlock *CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
// Objective-C fast enumeration 'for' statements:
// http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC
//
@@ -1795,7 +1795,7 @@ CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
// a DeclStmt and the other returns a DeclRefExpr.
//
- CFGBlock* LoopSuccessor = 0;
+ CFGBlock *LoopSuccessor = 0;
if (Block) {
if (badCFG)
@@ -1806,8 +1806,8 @@ CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
LoopSuccessor = Succ;
// Build the condition blocks.
- CFGBlock* ExitConditionBlock = createBlock(false);
- CFGBlock* EntryConditionBlock = ExitConditionBlock;
+ CFGBlock *ExitConditionBlock = createBlock(false);
+ CFGBlock *EntryConditionBlock = ExitConditionBlock;
// Set the terminator for the "exit" condition block.
ExitConditionBlock->setTerminator(S);
@@ -1842,7 +1842,7 @@ CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
BreakJumpTarget = JumpTarget(LoopSuccessor, ScopePos);
ContinueJumpTarget = JumpTarget(EntryConditionBlock, ScopePos);
- CFGBlock* BodyBlock = addStmt(S->getBody());
+ CFGBlock *BodyBlock = addStmt(S->getBody());
if (!BodyBlock)
BodyBlock = EntryConditionBlock; // can happen for "for (X in Y) ;"
@@ -1864,7 +1864,7 @@ CFGBlock* CFGBuilder::VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
return addStmt(S->getCollection());
}
-CFGBlock* CFGBuilder::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt* S) {
+CFGBlock *CFGBuilder::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
// FIXME: Add locking 'primitives' to CFG for @synchronized.
// Inline the body.
@@ -1888,13 +1888,13 @@ CFGBlock* CFGBuilder::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt* S) {
return addStmt(S->getSynchExpr());
}
-CFGBlock* CFGBuilder::VisitObjCAtTryStmt(ObjCAtTryStmt* S) {
+CFGBlock *CFGBuilder::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {
// FIXME
return NYS();
}
-CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) {
- CFGBlock* LoopSuccessor = NULL;
+CFGBlock *CFGBuilder::VisitWhileStmt(WhileStmt *W) {
+ CFGBlock *LoopSuccessor = NULL;
// Save local scope position because in case of condition variable ScopePos
// won't be restored when traversing AST.
@@ -1903,7 +1903,7 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) {
// Create local scope for possible condition variable.
// Store scope position for continue statement.
LocalScope::const_iterator LoopBeginScopePos = ScopePos;
- if (VarDecl* VD = W->getConditionVariable()) {
+ if (VarDecl *VD = W->getConditionVariable()) {
addLocalScopeForVarDecl(VD);
addAutomaticObjDtors(ScopePos, LoopBeginScopePos, W);
}
@@ -1921,8 +1921,8 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) {
// Because of short-circuit evaluation, the condition of the loop can span
// multiple basic blocks. Thus we need the "Entry" and "Exit" blocks that
// evaluate the condition.
- CFGBlock* ExitConditionBlock = createBlock(false);
- CFGBlock* EntryConditionBlock = ExitConditionBlock;
+ CFGBlock *ExitConditionBlock = createBlock(false);
+ CFGBlock *EntryConditionBlock = ExitConditionBlock;
// Set the terminator for the "exit" condition block.
ExitConditionBlock->setTerminator(W);
@@ -1930,7 +1930,7 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) {
// Now add the actual condition to the condition block. Because the condition
// itself may contain control-flow, new blocks may be created. Thus we update
// "Succ" after adding the condition.
- if (Stmt* C = W->getCond()) {
+ if (Stmt *C = W->getCond()) {
Block = ExitConditionBlock;
EntryConditionBlock = addStmt(C);
// The condition might finish the current 'Block'.
@@ -1992,7 +1992,7 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) {
addLocalScopeAndDtors(W->getBody());
// Create the body. The returned block is the entry to the loop body.
- CFGBlock* BodyBlock = addStmt(W->getBody());
+ CFGBlock *BodyBlock = addStmt(W->getBody());
if (!BodyBlock)
BodyBlock = ContinueJumpTarget.block; // can happen for "while(...) ;"
@@ -2019,13 +2019,13 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) {
}
-CFGBlock *CFGBuilder::VisitObjCAtCatchStmt(ObjCAtCatchStmt* S) {
+CFGBlock *CFGBuilder::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
// FIXME: For now we pretend that @catch and the code it contains does not
// exit.
return Block;
}
-CFGBlock* CFGBuilder::VisitObjCAtThrowStmt(ObjCAtThrowStmt* S) {
+CFGBlock *CFGBuilder::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {
// FIXME: This isn't complete. We basically treat @throw like a return
// statement.
@@ -2044,7 +2044,7 @@ CFGBlock* CFGBuilder::VisitObjCAtThrowStmt(ObjCAtThrowStmt* S) {
return VisitStmt(S, AddStmtChoice::AlwaysAdd);
}
-CFGBlock* CFGBuilder::VisitCXXThrowExpr(CXXThrowExpr* T) {
+CFGBlock *CFGBuilder::VisitCXXThrowExpr(CXXThrowExpr *T) {
// If we were in the middle of a block we stop processing that block.
if (badCFG)
return 0;
@@ -2064,8 +2064,8 @@ CFGBlock* CFGBuilder::VisitCXXThrowExpr(CXXThrowExpr* T) {
return VisitStmt(T, AddStmtChoice::AlwaysAdd);
}
-CFGBlock *CFGBuilder::VisitDoStmt(DoStmt* D) {
- CFGBlock* LoopSuccessor = NULL;
+CFGBlock *CFGBuilder::VisitDoStmt(DoStmt *D) {
+ CFGBlock *LoopSuccessor = NULL;
// "do...while" is a control-flow statement. Thus we stop processing the
// current block.
@@ -2079,15 +2079,15 @@ CFGBlock *CFGBuilder::VisitDoStmt(DoStmt* D) {
// Because of short-circuit evaluation, the condition of the loop can span
// multiple basic blocks. Thus we need the "Entry" and "Exit" blocks that
// evaluate the condition.
- CFGBlock* ExitConditionBlock = createBlock(false);
- CFGBlock* EntryConditionBlock = ExitConditionBlock;
+ CFGBlock *ExitConditionBlock = createBlock(false);
+ CFGBlock *EntryConditionBlock = ExitConditionBlock;
// Set the terminator for the "exit" condition block.
ExitConditionBlock->setTerminator(D);
// Now add the actual condition to the condition block. Because the condition
// itself may contain control-flow, new blocks may be created.
- if (Stmt* C = D->getCond()) {
+ if (Stmt *C = D->getCond()) {
Block = ExitConditionBlock;
EntryConditionBlock = addStmt(C);
if (Block) {
@@ -2103,7 +2103,7 @@ CFGBlock *CFGBuilder::VisitDoStmt(DoStmt* D) {
const TryResult &KnownVal = tryEvaluateBool(D->getCond());
// Process the loop body.
- CFGBlock* BodyBlock = NULL;
+ CFGBlock *BodyBlock = NULL;
{
assert(D->getBody());
@@ -2167,7 +2167,7 @@ CFGBlock *CFGBuilder::VisitDoStmt(DoStmt* D) {
return BodyBlock;
}
-CFGBlock* CFGBuilder::VisitContinueStmt(ContinueStmt* C) {
+CFGBlock *CFGBuilder::VisitContinueStmt(ContinueStmt *C) {
// "continue" is a control-flow statement. Thus we stop processing the
// current block.
if (badCFG)
@@ -2219,7 +2219,7 @@ CFGBlock *CFGBuilder::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E,
/// VisitStmtExpr - Utility method to handle (nested) statement
/// expressions (a GCC extension).
-CFGBlock* CFGBuilder::VisitStmtExpr(StmtExpr *SE, AddStmtChoice asc) {
+CFGBlock *CFGBuilder::VisitStmtExpr(StmtExpr *SE, AddStmtChoice asc) {
if (asc.alwaysAdd(*this, SE)) {
autoCreateBlock();
appendStmt(Block, SE);
@@ -2227,10 +2227,10 @@ CFGBlock* CFGBuilder::VisitStmtExpr(StmtExpr *SE, AddStmtChoice asc) {
return VisitCompoundStmt(SE->getSubStmt());
}
-CFGBlock* CFGBuilder::VisitSwitchStmt(SwitchStmt* Terminator) {
+CFGBlock *CFGBuilder::VisitSwitchStmt(SwitchStmt *Terminator) {
// "switch" is a control-flow statement. Thus we stop processing the current
// block.
- CFGBlock* SwitchSuccessor = NULL;
+ CFGBlock *SwitchSuccessor = NULL;
// Save local scope position because in case of condition variable ScopePos
// won't be restored when traversing AST.
@@ -2238,7 +2238,7 @@ CFGBlock* CFGBuilder::VisitSwitchStmt(SwitchStmt* Terminator) {
// Create local scope for possible condition variable.
// Store scope position. Add implicit destructor.
- if (VarDecl* VD = Terminator->getConditionVariable()) {
+ if (VarDecl *VD = Terminator->getConditionVariable()) {
LocalScope::const_iterator SwitchBeginScopePos = ScopePos;
addLocalScopeForVarDecl(VD);
addAutomaticObjDtors(ScopePos, SwitchBeginScopePos, Terminator);
@@ -2363,7 +2363,7 @@ static bool shouldAddCase(bool &switchExclusivelyCovered,
return addCase;
}
-CFGBlock* CFGBuilder::VisitCaseStmt(CaseStmt* CS) {
+CFGBlock *CFGBuilder::VisitCaseStmt(CaseStmt *CS) {
// CaseStmts are essentially labels, so they are the first statement in a
// block.
CFGBlock *TopBlock = 0, *LastBlock = 0;
@@ -2394,7 +2394,7 @@ CFGBlock* CFGBuilder::VisitCaseStmt(CaseStmt* CS) {
addStmt(Sub);
}
- CFGBlock* CaseBlock = Block;
+ CFGBlock *CaseBlock = Block;
if (!CaseBlock)
CaseBlock = createBlock();
@@ -2427,7 +2427,7 @@ CFGBlock* CFGBuilder::VisitCaseStmt(CaseStmt* CS) {
return Succ;
}
-CFGBlock* CFGBuilder::VisitDefaultStmt(DefaultStmt* Terminator) {
+CFGBlock *CFGBuilder::VisitDefaultStmt(DefaultStmt *Terminator) {
if (Terminator->getSubStmt())
addStmt(Terminator->getSubStmt());
@@ -2461,7 +2461,7 @@ CFGBlock* CFGBuilder::VisitDefaultStmt(DefaultStmt* Terminator) {
CFGBlock *CFGBuilder::VisitCXXTryStmt(CXXTryStmt *Terminator) {
// "try"/"catch" is a control-flow statement. Thus we stop processing the
// current block.
- CFGBlock* TrySuccessor = NULL;
+ CFGBlock *TrySuccessor = NULL;
if (Block) {
if (badCFG)
@@ -2512,7 +2512,7 @@ CFGBlock *CFGBuilder::VisitCXXTryStmt(CXXTryStmt *Terminator) {
return Block;
}
-CFGBlock* CFGBuilder::VisitCXXCatchStmt(CXXCatchStmt* CS) {
+CFGBlock *CFGBuilder::VisitCXXCatchStmt(CXXCatchStmt *CS) {
// CXXCatchStmt are treated like labels, so they are the first statement in a
// block.
@@ -2522,7 +2522,7 @@ CFGBlock* CFGBuilder::VisitCXXCatchStmt(CXXCatchStmt* CS) {
// Create local scope for possible exception variable.
// Store scope position. Add implicit destructor.
- if (VarDecl* VD = CS->getExceptionDecl()) {
+ if (VarDecl *VD = CS->getExceptionDecl()) {
LocalScope::const_iterator BeginScopePos = ScopePos;
addLocalScopeForVarDecl(VD);
addAutomaticObjDtors(ScopePos, BeginScopePos, CS);
@@ -2531,7 +2531,7 @@ CFGBlock* CFGBuilder::VisitCXXCatchStmt(CXXCatchStmt* CS) {
if (CS->getHandlerBlock())
addStmt(CS->getHandlerBlock());
- CFGBlock* CatchBlock = Block;
+ CFGBlock *CatchBlock = Block;
if (!CatchBlock)
CatchBlock = createBlock();
@@ -2546,7 +2546,7 @@ CFGBlock* CFGBuilder::VisitCXXCatchStmt(CXXCatchStmt* CS) {
return CatchBlock;
}
-CFGBlock* CFGBuilder::VisitCXXForRangeStmt(CXXForRangeStmt* S) {
+CFGBlock *CFGBuilder::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
// C++0x for-range statements are specified as [stmt.ranged]:
//
// {
@@ -2574,7 +2574,7 @@ CFGBlock* CFGBuilder::VisitCXXForRangeStmt(CXXForRangeStmt* S) {
// "for" is a control-flow statement. Thus we stop processing the current
// block.
- CFGBlock* LoopSuccessor = NULL;
+ CFGBlock *LoopSuccessor = NULL;
if (Block) {
if (badCFG)
return 0;
@@ -2588,7 +2588,7 @@ CFGBlock* CFGBuilder::VisitCXXForRangeStmt(CXXForRangeStmt* S) {
BreakJumpTarget = JumpTarget(LoopSuccessor, ScopePos);
// The block for the __begin != __end expression.
- CFGBlock* ConditionBlock = createBlock(false);
+ CFGBlock *ConditionBlock = createBlock(false);
ConditionBlock->setTerminator(S);
// Now add the actual condition to the condition block.
@@ -2724,9 +2724,9 @@ CFGBlock *CFGBuilder::VisitImplicitCastExpr(ImplicitCastExpr *E,
return Visit(E->getSubExpr(), AddStmtChoice());
}
-CFGBlock* CFGBuilder::VisitIndirectGotoStmt(IndirectGotoStmt* I) {
+CFGBlock *CFGBuilder::VisitIndirectGotoStmt(IndirectGotoStmt *I) {
// Lazily create the indirect-goto dispatch block if there isn't one already.
- CFGBlock* IBlock = cfg->getIndirectGotoBlock();
+ CFGBlock *IBlock = cfg->getIndirectGotoBlock();
if (!IBlock) {
IBlock = createBlock(false);
@@ -2948,7 +2948,7 @@ CFGBlock *CFGBuilder::VisitConditionalOperatorForTemporaryDtors(
/// createBlock - Constructs and adds a new CFGBlock to the CFG. The block has
/// no successors or predecessors. If this is the first block created in the
/// CFG, it is automatically set to be the Entry and Exit of the CFG.
-CFGBlock* CFG::createBlock() {