(Op == BinaryOperator::LOr && !branchTaken)
? B->getRHS() : B->getLHS();
- return SetBlkExprRVal(St, B, UninitializedVal(Ex));
+ return SetBlkExprRVal(St, B, UndefinedVal(Ex));
}
case Stmt::ConditionalOperatorClass: { // ?:
else
Ex = C->getRHS();
- return SetBlkExprRVal(St, C, UninitializedVal(Ex));
+ return SetBlkExprRVal(St, C, UndefinedVal(Ex));
}
case Stmt::ChooseExprClass: { // ?:
ChooseExpr* C = cast<ChooseExpr>(Terminator);
Expr* Ex = branchTaken ? C->getLHS() : C->getRHS();
- return SetBlkExprRVal(St, C, UninitializedVal(Ex));
+ return SetBlkExprRVal(St, C, UndefinedVal(Ex));
}
}
}
builder.generateNode(MarkBranch(PrevState, Term, false), false);
return;
- case RVal::UninitializedKind: {
+ case RVal::UndefinedKind: {
NodeTy* N = builder.generateNode(PrevState, true);
if (N) {
N->markAsSink();
- UninitBranches.insert(N);
+ UndefBranches.insert(N);
}
builder.markInfeasible(false);
// Three possibilities:
//
// (1) We know the computed label.
- // (2) The label is NULL (or some other constant), or Uninitialized.
+ // (2) The label is NULL (or some other constant), or Undefined.
// (3) We have no clue about the label. Dispatch to all targets.
//
return;
}
- if (isa<lval::ConcreteInt>(V) || isa<UninitializedVal>(V)) {
+ if (isa<lval::ConcreteInt>(V) || isa<UndefinedVal>(V)) {
// Dispatch to the first target and mark it as a sink.
NodeTy* N = builder.generateNode(builder.begin(), St, true);
- UninitBranches.insert(N);
+ UndefBranches.insert(N);
return;
}
Expr* CondE = builder.getCondition();
RVal CondV = GetRVal(St, CondE);
- if (CondV.isUninit()) {
+ if (CondV.isUndef()) {
NodeTy* N = builder.generateDefaultCaseNode(St, true);
- UninitBranches.insert(N);
+ UndefBranches.insert(N);
return;
}
StateTy St = Pred->getState();
RVal X = GetBlkExprRVal(St, B);
- assert (X.isUninit());
+ assert (X.isUndef());
- Expr* Ex = (Expr*) cast<UninitializedVal>(X).getData();
+ Expr* Ex = (Expr*) cast<UndefinedVal>(X).getData();
assert (Ex);
X = GetBlkExprRVal(St, Ex);
- // Handle uninitialized values.
+ // Handle undefined values.
- if (X.isUninit()) {
+ if (X.isUndef()) {
Nodify(Dst, B, Pred, SetBlkExprRVal(St, B, X));
return;
}
StateTy St = (*DI)->getState();
RVal L = GetLVal(St, Callee);
- // Check for uninitialized control-flow.
+ // Check for undefined control-flow.
- if (L.isUninit()) {
+ if (L.isUndef()) {
NodeTy* N = Builder->generateNode(CE, St, *DI);
N->markAsSink();
- UninitBranches.insert(N);
+ UndefBranches.insert(N);
continue;
}
!isa<FileVarDecl>(VD));
// If there is no initializer, set the value of the
- // variable to "Uninitialized".
+ // variable to "Undefined".
//
// FIXME: static variables may have an initializer, but the second
// time a function is called those values may not be current.
St = SetRVal(St, lval::DeclVal(VD),
- Ex ? GetRVal(St, Ex) : UninitializedVal());
+ Ex ? GetRVal(St, Ex) : UndefinedVal());
}
}
StateTy St = Pred->getState();
RVal X = GetBlkExprRVal(St, Ex);
- assert (X.isUninit());
+ assert (X.isUndef());
- Expr* SE = (Expr*) cast<UninitializedVal>(X).getData();
+ Expr* SE = (Expr*) cast<UndefinedVal>(X).getData();
assert (SE);
RVal V = GetRVal(St, Ex);
- // Check for dereferences of uninitialized values.
+ // Check for dereferences of undefined values.
- if (V.isUninit()) {
+ if (V.isUndef()) {
NodeTy* Succ = Builder->generateNode(U, St, N);
if (Succ) {
Succ->markAsSink();
- UninitDeref.insert(Succ);
+ UndefDeref.insert(Succ);
}
continue;
continue;
}
- if (SubV.isUninit()) {
+ if (SubV.isUndef()) {
Nodify(Dst, U, N1, SetRVal(St, U, SubV));
continue;
}
continue;
}
- // Propagate uninitialized values.
- if (V.isUninit()) {
+ // Propagate undefined values.
+ if (V.isUndef()) {
Nodify(Dst, U, N1, SetRVal(St, U, V));
continue;
}
if ((Op == BinaryOperator::Div || Op == BinaryOperator::Rem)
&& RHS->getType()->isIntegerType()) {
- // Check if the denominator is uninitialized.
+ // Check if the denominator is undefined.
if (!RightV.isUnknown()) {
- if (RightV.isUninit()) {
- NodeTy* DivUninit = Builder->generateNode(B, St, N2);
+ if (RightV.isUndef()) {
+ NodeTy* DivUndef = Builder->generateNode(B, St, N2);
- if (DivUninit) {
- DivUninit->markAsSink();
- BadDivides.insert(DivUninit);
+ if (DivUndef) {
+ DivUndef->markAsSink();
+ BadDivides.insert(DivUndef);
}
continue;
// Check for divide/remainder-by-zero.
//
- // First, "assume" that the denominator is 0 or uninitialized.
+ // First, "assume" that the denominator is 0 or undefined.
bool isFeasible = false;
StateTy ZeroSt = Assume(St, RightV, false, isFeasible);
// Simple assignments.
- if (LeftV.isUninit()) {
- HandleUninitializedStore(B, N2);
+ if (LeftV.isUndef()) {
+ HandleUndefinedStore(B, N2);
continue;
}
else
((int&) Op) -= BinaryOperator::MulAssign;
- // Check if the LHS is uninitialized.
+ // Check if the LHS is undefined.
- if (LeftV.isUninit()) {
- HandleUninitializedStore(B, N2);
+ if (LeftV.isUndef()) {
+ HandleUndefinedStore(B, N2);
continue;
}
RVal V = GetRVal(N1->getState(), LeftLV, B->getLHS()->getType());
- // Propagate uninitialized value (left-side). We
- // propogate uninitialized values for the RHS below when
+ // Propagate undefined value (left-side). We
+ // propogate undefined values for the RHS below when
// we also check for divide-by-zero.
- if (V.isUninit()) {
+ if (V.isUndef()) {
St = SetRVal(St, B, V);
break;
}
// At this point:
//
- // The LHS is not Uninit/Unknown.
+ // The LHS is not Undef/Unknown.
// The RHS is not Unknown.
// Get the computation type.
if ((Op == BinaryOperator::Div || Op == BinaryOperator::Rem)
&& RHS->getType()->isIntegerType()) {
- // Check if the denominator is uninitialized.
+ // Check if the denominator is undefined.
- if (RightV.isUninit()) {
- NodeTy* DivUninit = Builder->generateNode(B, St, N2);
+ if (RightV.isUndef()) {
+ NodeTy* DivUndef = Builder->generateNode(B, St, N2);
- if (DivUninit) {
- DivUninit->markAsSink();
- BadDivides.insert(DivUninit);
+ if (DivUndef) {
+ DivUndef->markAsSink();
+ BadDivides.insert(DivUndef);
}
continue;
}
else {
- // Propagate uninitialized values (right-side).
+ // Propagate undefined values (right-side).
- if (RightV.isUninit()) {
+ if (RightV.isUndef()) {
St = SetRVal(SetRVal(St, B, RightV), LeftLV, RightV);
break;
}
}
}
-void GRExprEngine::HandleUninitializedStore(Stmt* S, NodeTy* Pred) {
+void GRExprEngine::HandleUndefinedStore(Stmt* S, NodeTy* Pred) {
NodeTy* N = Builder->generateNode(S, Pred->getState(), Pred);
N->markAsSink();
- UninitStores.insert(N);
+ UndefStores.insert(N);
}
void GRExprEngine::Visit(Stmt* S, NodeTy* Pred, NodeSet& Dst) {
if (GraphPrintCheckerState->isImplicitNullDeref(N) ||
GraphPrintCheckerState->isExplicitNullDeref(N) ||
- GraphPrintCheckerState->isUninitDeref(N) ||
- GraphPrintCheckerState->isUninitStore(N) ||
- GraphPrintCheckerState->isUninitControlFlow(N) ||
+ GraphPrintCheckerState->isUndefDeref(N) ||
+ GraphPrintCheckerState->isUndefStore(N) ||
+ GraphPrintCheckerState->isUndefControlFlow(N) ||
GraphPrintCheckerState->isBadDivide(N))
return "color=\"red\",style=\"filled\"";
else if (GraphPrintCheckerState->isExplicitNullDeref(N)) {
Out << "\\|Explicit-Null Dereference.\\l";
}
- else if (GraphPrintCheckerState->isUninitDeref(N)) {
- Out << "\\|Dereference of uninitialied value.\\l";
+ else if (GraphPrintCheckerState->isUndefDeref(N)) {
+ Out << "\\|Dereference of undefialied value.\\l";
}
- else if (GraphPrintCheckerState->isUninitStore(N)) {
- Out << "\\|Store to Uninitialized LVal.";
+ else if (GraphPrintCheckerState->isUndefStore(N)) {
+ Out << "\\|Store to Undefined LVal.";
}
else if (GraphPrintCheckerState->isBadDivide(N)) {
- Out << "\\|Divide-by zero or uninitialized value.";
+ Out << "\\|Divide-by zero or undefined value.";
}
break;
Out << "\\l";
}
- if (GraphPrintCheckerState->isUninitControlFlow(N)) {
- Out << "\\|Control-flow based on\\lUninitialized value.\\l";
+ if (GraphPrintCheckerState->isUndefControlFlow(N)) {
+ Out << "\\|Control-flow based on\\lUndefined value.\\l";
}
}
}
/// CurrentStmt - The current block-level statement.
Stmt* CurrentStmt;
- typedef llvm::SmallPtrSet<NodeTy*,2> UninitBranchesTy;
- typedef llvm::SmallPtrSet<NodeTy*,2> UninitStoresTy;
+ typedef llvm::SmallPtrSet<NodeTy*,2> UndefBranchesTy;
+ typedef llvm::SmallPtrSet<NodeTy*,2> UndefStoresTy;
typedef llvm::SmallPtrSet<NodeTy*,2> BadDerefTy;
typedef llvm::SmallPtrSet<NodeTy*,2> BadDividesTy;
typedef llvm::SmallPtrSet<NodeTy*,2> NoReturnCallsTy;
- /// UninitBranches - Nodes in the ExplodedGraph that result from
- /// taking a branch based on an uninitialized value.
- UninitBranchesTy UninitBranches;
+ /// UndefBranches - Nodes in the ExplodedGraph that result from
+ /// taking a branch based on an undefined value.
+ UndefBranchesTy UndefBranches;
- /// UninitStores - Sinks in the ExplodedGraph that result from
- /// making a store to an uninitialized lvalue.
- UninitStoresTy UninitStores;
+ /// UndefStores - Sinks in the ExplodedGraph that result from
+ /// making a store to an undefined lvalue.
+ UndefStoresTy UndefStores;
/// NoReturnCalls - Sinks in the ExplodedGraph that result from
// calling a function with the attribute "noreturn".
BadDerefTy ExplicitNullDeref;
/// UnitDeref - Nodes in the ExplodedGraph that result from
- /// taking a dereference on an uninitialized value.
- BadDerefTy UninitDeref;
+ /// taking a dereference on an undefined value.
+ BadDerefTy UndefDeref;
/// BadDivides - Nodes in the ExplodedGraph that result from evaluating
- /// a divide-by-zero or divide-by-uninitialized.
+ /// a divide-by-zero or divide-by-undefined.
BadDividesTy BadDivides;
bool StateCleaned;
/// in the ExplodedGraph.
StateTy getInitialState();
- bool isUninitControlFlow(const NodeTy* N) const {
- return N->isSink() && UninitBranches.count(const_cast<NodeTy*>(N)) != 0;
+ bool isUndefControlFlow(const NodeTy* N) const {
+ return N->isSink() && UndefBranches.count(const_cast<NodeTy*>(N)) != 0;
}
- bool isUninitStore(const NodeTy* N) const {
- return N->isSink() && UninitStores.count(const_cast<NodeTy*>(N)) != 0;
+ bool isUndefStore(const NodeTy* N) const {
+ return N->isSink() && UndefStores.count(const_cast<NodeTy*>(N)) != 0;
}
bool isImplicitNullDeref(const NodeTy* N) const {
return N->isSink() && ExplicitNullDeref.count(const_cast<NodeTy*>(N)) != 0;
}
- bool isUninitDeref(const NodeTy* N) const {
- return N->isSink() && UninitDeref.count(const_cast<NodeTy*>(N)) != 0;
+ bool isUndefDeref(const NodeTy* N) const {
+ return N->isSink() && UndefDeref.count(const_cast<NodeTy*>(N)) != 0;
}
bool isBadDivide(const NodeTy* N) const {
null_deref_iterator null_derefs_begin() { return ExplicitNullDeref.begin(); }
null_deref_iterator null_derefs_end() { return ExplicitNullDeref.end(); }
- typedef BadDerefTy::iterator uninit_deref_iterator;
- uninit_deref_iterator uninit_derefs_begin() { return UninitDeref.begin(); }
- uninit_deref_iterator uninit_derefs_end() { return UninitDeref.end(); }
+ typedef BadDerefTy::iterator undef_deref_iterator;
+ undef_deref_iterator undef_derefs_begin() { return UndefDeref.begin(); }
+ undef_deref_iterator undef_derefs_end() { return UndefDeref.end(); }
typedef BadDividesTy::iterator bad_divide_iterator;
bad_divide_iterator bad_divides_begin() { return BadDivides.begin(); }
/// The states are not guaranteed to be unique.
void Nodify(NodeSet& Dst, Stmt* S, NodeTy* Pred, const StateTy::BufferTy& SB);
- /// HandleUninitializedStore - Create the necessary sink node to represent
- /// a store to an "uninitialized" LVal.
- void HandleUninitializedStore(Stmt* S, NodeTy* Pred);
+ /// HandleUndefinedStore - Create the necessary sink node to represent
+ /// a store to an "undefined" LVal.
+ void HandleUndefinedStore(Stmt* S, NodeTy* Pred);
/// Visit - Transfer function logic for all statements. Dispatches to
/// other functions that handle specific kinds of statements.
void VisitDeref(UnaryOperator* B, NodeTy* Pred, NodeSet& Dst);
RVal EvalCast(RVal X, QualType CastT) {
- if (X.isUnknownOrUninit())
+ if (X.isUnknownOrUndef())
return X;
if (isa<LVal>(X))
RVal EvalBinOp(BinaryOperator::Opcode Op, RVal L, RVal R) {
- if (L.isUninit() || R.isUninit())
- return UninitializedVal();
+ if (L.isUndef() || R.isUndef())
+ return UndefinedVal();
if (L.isUnknown() || R.isUnknown())
return UnknownVal();