summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/clang/lib/Analysis/UninitializedValues.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Analysis/UninitializedValues.cpp')
-rw-r--r--contrib/llvm/tools/clang/lib/Analysis/UninitializedValues.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/contrib/llvm/tools/clang/lib/Analysis/UninitializedValues.cpp b/contrib/llvm/tools/clang/lib/Analysis/UninitializedValues.cpp
index 0f43efa..c08cbed 100644
--- a/contrib/llvm/tools/clang/lib/Analysis/UninitializedValues.cpp
+++ b/contrib/llvm/tools/clang/lib/Analysis/UninitializedValues.cpp
@@ -72,13 +72,15 @@ public:
bool VisitStmt(Stmt* S);
bool VisitCallExpr(CallExpr* C);
bool VisitDeclStmt(DeclStmt* D);
- bool VisitConditionalOperator(ConditionalOperator* C);
+ bool VisitAbstractConditionalOperator(AbstractConditionalOperator* C);
bool BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S);
bool Visit(Stmt *S);
bool BlockStmt_VisitExpr(Expr* E);
void VisitTerminator(CFGBlock* B) { }
+
+ void setCurrentBlock(const CFGBlock *block) {}
};
static const bool Initialized = false;
@@ -87,7 +89,7 @@ static const bool Uninitialized = true;
bool TransferFuncs::VisitDeclRefExpr(DeclRefExpr* DR) {
if (VarDecl* VD = dyn_cast<VarDecl>(DR->getDecl()))
- if (VD->isBlockVarDecl()) {
+ if (VD->isLocalVarDecl()) {
if (AD.Observer)
AD.Observer->ObserveDeclRefExpr(V, AD, DR, VD);
@@ -112,7 +114,7 @@ static VarDecl* FindBlockVarDecl(Expr* E) {
if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E->IgnoreParenCasts()))
if (VarDecl* VD = dyn_cast<VarDecl>(DR->getDecl()))
- if (VD->isBlockVarDecl()) return VD;
+ if (VD->isLocalVarDecl()) return VD;
return NULL;
}
@@ -133,7 +135,7 @@ bool TransferFuncs::VisitBinaryOperator(BinaryOperator* B) {
bool TransferFuncs::VisitDeclStmt(DeclStmt* S) {
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 (VD && VD->isLocalVarDecl()) {
if (Stmt* I = VD->getInit()) {
// Visit the subexpression to check for uses of uninitialized values,
// even if we don't propagate that value.
@@ -170,7 +172,7 @@ bool TransferFuncs::VisitUnaryOperator(UnaryOperator* U) {
switch (U->getOpcode()) {
case UO_AddrOf: {
VarDecl* VD = FindBlockVarDecl(U->getSubExpr());
- if (VD && VD->isBlockVarDecl())
+ if (VD && VD->isLocalVarDecl())
return V(VD,AD) = Initialized;
break;
}
@@ -211,13 +213,14 @@ TransferFuncs::BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
}
-bool TransferFuncs::VisitConditionalOperator(ConditionalOperator* C) {
+bool TransferFuncs::
+VisitAbstractConditionalOperator(AbstractConditionalOperator* C) {
Visit(C->getCond());
- bool rhsResult = Visit(C->getRHS());
+ bool rhsResult = Visit(C->getFalseExpr());
// Handle the GNU extension for missing LHS.
- if (Expr *lhs = C->getLHS())
- return Visit(lhs) & rhsResult; // Yes: we want &, not &&.
+ if (isa<ConditionalOperator>(C))
+ return Visit(C->getTrueExpr()) & rhsResult; // Yes: we want &, not &&.
else
return rhsResult;
}
@@ -228,7 +231,7 @@ bool TransferFuncs::VisitStmt(Stmt* S) {
// We don't stop at the first subexpression that is Uninitialized because
// evaluating some subexpressions may result in propogating "Uninitialized"
// or "Initialized" to variables referenced in the other subexpressions.
- for (Stmt::child_iterator I=S->child_begin(), E=S->child_end(); I!=E; ++I)
+ for (Stmt::child_range I = S->children(); I; ++I)
if (*I && Visit(*I) == Uninitialized) x = Uninitialized;
return x;
OpenPOWER on IntegriCloud