summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/Stmt.cpp5
-rw-r--r--clang/lib/Analysis/CheckDeadStores.cpp5
-rw-r--r--clang/lib/Analysis/LiveVariables.cpp5
-rw-r--r--clang/lib/Analysis/UninitializedValues.cpp4
4 files changed, 13 insertions, 6 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp
index d3f3ff0e111..76538a8b188 100644
--- a/clang/lib/AST/Stmt.cpp
+++ b/clang/lib/AST/Stmt.cpp
@@ -193,6 +193,11 @@ ObjCAtCatchStmt::ObjCAtCatchStmt(SourceLocation atCatchLoc,
Stmt::child_iterator DeclStmt::child_begin() { return getDecl(); }
Stmt::child_iterator DeclStmt::child_end() { return child_iterator(); }
+DeclStmt::decl_iterator& DeclStmt::decl_iterator::operator++() {
+ D = D->getNextDeclarator();
+ return *this;
+}
+
// NullStmt
Stmt::child_iterator NullStmt::child_begin() { return child_iterator(); }
Stmt::child_iterator NullStmt::child_end() { return child_iterator(); }
diff --git a/clang/lib/Analysis/CheckDeadStores.cpp b/clang/lib/Analysis/CheckDeadStores.cpp
index f0d3dd1b623..38078e38236 100644
--- a/clang/lib/Analysis/CheckDeadStores.cpp
+++ b/clang/lib/Analysis/CheckDeadStores.cpp
@@ -161,9 +161,10 @@ public:
else if (DeclStmt* DS = dyn_cast<DeclStmt>(S))
// Iterate through the decls. Warn if any initializers are complex
// expressions that are not live (never used).
- for (ScopedDecl* SD = DS->getDecl(); SD; SD = SD->getNextDeclarator()) {
+ for (DeclStmt::decl_iterator DI=DS->decl_begin(), DE=DS->decl_end();
+ DI != DE; ++DI) {
- VarDecl* V = dyn_cast<VarDecl>(SD);
+ VarDecl* V = dyn_cast<VarDecl>(*DI);
if (!V)
continue;
diff --git a/clang/lib/Analysis/LiveVariables.cpp b/clang/lib/Analysis/LiveVariables.cpp
index 8f391dc5618..f5a7fb40c77 100644
--- a/clang/lib/Analysis/LiveVariables.cpp
+++ b/clang/lib/Analysis/LiveVariables.cpp
@@ -229,8 +229,9 @@ void TransferFuncs::VisitAssign(BinaryOperator* B) {
void TransferFuncs::VisitDeclStmt(DeclStmt* DS) {
// Declarations effectively "kill" a variable since they cannot
// possibly be live before they are declared.
- for (ScopedDecl* D = DS->getDecl(); D != NULL; D = D->getNextDeclarator())
- if (VarDecl* VD = dyn_cast<VarDecl>(D)) {
+ for (DeclStmt::decl_iterator DI=DS->decl_begin(), DE = DS->decl_end();
+ DI != DE; ++DI)
+ if (VarDecl* VD = dyn_cast<VarDecl>(*DI)) {
// Update liveness information.
unsigned bit = AD.getIdx(VD);
diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp
index 15c11ba6b0d..83f1a7083e2 100644
--- a/clang/lib/Analysis/UninitializedValues.cpp
+++ b/clang/lib/Analysis/UninitializedValues.cpp
@@ -131,8 +131,8 @@ bool TransferFuncs::VisitBinaryOperator(BinaryOperator* B) {
}
bool TransferFuncs::VisitDeclStmt(DeclStmt* S) {
- for (ScopedDecl* D = S->getDecl(); D != NULL; D = D->getNextDeclarator()) {
- VarDecl *VD = dyn_cast<VarDecl>(D);
+ for (DeclStmt::decl_iterator I=S->decl_begin(), E=S->decl_end(); I!=E; ++I) {
+ VarDecl *VD = dyn_cast<VarDecl>(*I);
if (VD && VD->isBlockVarDecl()) {
if (Stmt* I = VD->getInit())
V(VD,AD) = AD.FullUninitTaint ? V(cast<Expr>(I),AD) : Initialized;
OpenPOWER on IntegriCloud