Remove some stale ErrorNodes variables in GRExprEngine and the old buffer overflow logic in GRExprEngineInternalChecks.cpp.
llvm-svn: 86877
This commit is contained in:
parent
9f34406a90
commit
7cf8238291
|
|
@ -111,14 +111,6 @@ public:
|
|||
// was larger than sizeof(void *) (an undefined value).
|
||||
ErrorNodes NilReceiverLargerThanVoidPtrRetImplicit;
|
||||
|
||||
/// RetsStackAddr - Nodes in the ExplodedGraph that result from returning
|
||||
/// the address of a stack variable.
|
||||
ErrorNodes RetsStackAddr;
|
||||
|
||||
/// RetsUndef - Nodes in the ExplodedGraph that result from returning
|
||||
/// an undefined value.
|
||||
ErrorNodes RetsUndef;
|
||||
|
||||
/// UndefBranches - Nodes in the ExplodedGraph that result from
|
||||
/// taking a branch based on an undefined value.
|
||||
ErrorNodes UndefBranches;
|
||||
|
|
@ -131,22 +123,10 @@ public:
|
|||
// calling a function with the attribute "noreturn".
|
||||
ErrorNodes NoReturnCalls;
|
||||
|
||||
/// ImplicitBadSizedVLA - Nodes in the ExplodedGraph that result from
|
||||
/// constructing a zero-sized VLA where the size may be zero.
|
||||
ErrorNodes ImplicitBadSizedVLA;
|
||||
|
||||
/// ExplicitBadSizedVLA - Nodes in the ExplodedGraph that result from
|
||||
/// constructing a zero-sized VLA where the size must be zero.
|
||||
ErrorNodes ExplicitBadSizedVLA;
|
||||
|
||||
/// UndefResults - Nodes in the ExplodedGraph where the operands are defined
|
||||
/// by the result is not. Excludes divide-by-zero errors.
|
||||
ErrorNodes UndefResults;
|
||||
|
||||
/// BadCalls - Nodes in the ExplodedGraph resulting from calls to function
|
||||
/// pointers that are NULL (or other constants) or Undefined.
|
||||
ErrorNodes BadCalls;
|
||||
|
||||
/// UndefReceiver - Nodes in the ExplodedGraph resulting from message
|
||||
/// ObjC message expressions where the receiver is undefined (uninitialized).
|
||||
ErrorNodes UndefReceivers;
|
||||
|
|
@ -156,14 +136,6 @@ public:
|
|||
/// value.
|
||||
UndefArgsTy MsgExprUndefArgs;
|
||||
|
||||
/// OutOfBoundMemAccesses - Nodes in the ExplodedGraph resulting from
|
||||
/// out-of-bound memory accesses where the index MAY be out-of-bound.
|
||||
ErrorNodes ImplicitOOBMemAccesses;
|
||||
|
||||
/// OutOfBoundMemAccesses - Nodes in the ExplodedGraph resulting from
|
||||
/// out-of-bound memory accesses where the index MUST be out-of-bound.
|
||||
ErrorNodes ExplicitOOBMemAccesses;
|
||||
|
||||
public:
|
||||
GRExprEngine(AnalysisManager &mgr);
|
||||
|
||||
|
|
@ -223,46 +195,10 @@ public:
|
|||
return static_cast<CHECKER*>(lookupChecker(CHECKER::getTag()));
|
||||
}
|
||||
|
||||
bool isUndefControlFlow(const ExplodedNode* N) const {
|
||||
return N->isSink() && UndefBranches.count(const_cast<ExplodedNode*>(N)) != 0;
|
||||
}
|
||||
|
||||
bool isUndefStore(const ExplodedNode* N) const {
|
||||
return N->isSink() && UndefStores.count(const_cast<ExplodedNode*>(N)) != 0;
|
||||
}
|
||||
|
||||
bool isImplicitNullDeref(const ExplodedNode* N) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isExplicitNullDeref(const ExplodedNode* N) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isUndefDeref(const ExplodedNode* N) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isNoReturnCall(const ExplodedNode* N) const {
|
||||
return N->isSink() && NoReturnCalls.count(const_cast<ExplodedNode*>(N)) != 0;
|
||||
}
|
||||
|
||||
bool isUndefResult(const ExplodedNode* N) const {
|
||||
return N->isSink() && UndefResults.count(const_cast<ExplodedNode*>(N)) != 0;
|
||||
}
|
||||
|
||||
bool isBadCall(const ExplodedNode* N) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isUndefArg(const ExplodedNode* N) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isUndefReceiver(const ExplodedNode* N) const {
|
||||
return N->isSink() && UndefReceivers.count(const_cast<ExplodedNode*>(N)) != 0;
|
||||
}
|
||||
|
||||
typedef ErrorNodes::iterator undef_branch_iterator;
|
||||
undef_branch_iterator undef_branches_begin() { return UndefBranches.begin(); }
|
||||
undef_branch_iterator undef_branches_end() { return UndefBranches.end(); }
|
||||
|
|
@ -293,10 +229,6 @@ public:
|
|||
undef_result_iterator undef_results_begin() { return UndefResults.begin(); }
|
||||
undef_result_iterator undef_results_end() { return UndefResults.end(); }
|
||||
|
||||
typedef ErrorNodes::iterator bad_calls_iterator;
|
||||
bad_calls_iterator bad_calls_begin() { return BadCalls.begin(); }
|
||||
bad_calls_iterator bad_calls_end() { return BadCalls.end(); }
|
||||
|
||||
typedef UndefArgsTy::iterator undef_arg_iterator;
|
||||
undef_arg_iterator msg_expr_undef_arg_begin() {
|
||||
return MsgExprUndefArgs.begin();
|
||||
|
|
@ -315,20 +247,6 @@ public:
|
|||
return UndefReceivers.end();
|
||||
}
|
||||
|
||||
typedef ErrorNodes::iterator oob_memacc_iterator;
|
||||
oob_memacc_iterator implicit_oob_memacc_begin() {
|
||||
return ImplicitOOBMemAccesses.begin();
|
||||
}
|
||||
oob_memacc_iterator implicit_oob_memacc_end() {
|
||||
return ImplicitOOBMemAccesses.end();
|
||||
}
|
||||
oob_memacc_iterator explicit_oob_memacc_begin() {
|
||||
return ExplicitOOBMemAccesses.begin();
|
||||
}
|
||||
oob_memacc_iterator explicit_oob_memacc_end() {
|
||||
return ExplicitOOBMemAccesses.end();
|
||||
}
|
||||
|
||||
void AddCheck(GRSimpleAPICheck* A, Stmt::StmtClass C);
|
||||
void AddCheck(GRSimpleAPICheck* A);
|
||||
|
||||
|
|
|
|||
|
|
@ -2842,6 +2842,9 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<ExplodedNode*> :
|
|||
// work.
|
||||
static std::string getNodeAttributes(const ExplodedNode* N, void*) {
|
||||
|
||||
#if 0
|
||||
// FIXME: Replace with a general scheme to tell if the node is
|
||||
// an error node.
|
||||
if (GraphPrintCheckerState->isImplicitNullDeref(N) ||
|
||||
GraphPrintCheckerState->isExplicitNullDeref(N) ||
|
||||
GraphPrintCheckerState->isUndefDeref(N) ||
|
||||
|
|
@ -2851,6 +2854,7 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<ExplodedNode*> :
|
|||
GraphPrintCheckerState->isBadCall(N) ||
|
||||
GraphPrintCheckerState->isUndefArg(N))
|
||||
return "color=\"red\",style=\"filled\"";
|
||||
#endif
|
||||
|
||||
if (GraphPrintCheckerState->isNoReturnCall(N))
|
||||
return "color=\"blue\",style=\"filled\"";
|
||||
|
|
@ -2902,6 +2906,9 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<ExplodedNode*> :
|
|||
else if (isa<PostLValue>(Loc))
|
||||
Out << "\\lPostLValue\\l";
|
||||
|
||||
#if 0
|
||||
// FIXME: Replace with a general scheme to determine
|
||||
// the name of the check.
|
||||
if (GraphPrintCheckerState->isImplicitNullDeref(N))
|
||||
Out << "\\|Implicit-Null Dereference.\\l";
|
||||
else if (GraphPrintCheckerState->isExplicitNullDeref(N))
|
||||
|
|
@ -2918,6 +2925,7 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<ExplodedNode*> :
|
|||
Out << "\\|Call to NULL/Undefined.";
|
||||
else if (GraphPrintCheckerState->isUndefArg(N))
|
||||
Out << "\\|Argument in call is undefined";
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -2979,9 +2987,13 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<ExplodedNode*> :
|
|||
Out << "\\l";
|
||||
}
|
||||
|
||||
#if 0
|
||||
// FIXME: Replace with a general scheme to determine
|
||||
// the name of the check.
|
||||
if (GraphPrintCheckerState->isUndefControlFlow(N)) {
|
||||
Out << "\\|Control-flow based on\\lUndefined value.\\l";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -361,17 +361,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class VISIBILITY_HIDDEN OutOfBoundMemoryAccess : public BuiltinBug {
|
||||
public:
|
||||
OutOfBoundMemoryAccess(GRExprEngine* eng)
|
||||
: BuiltinBug(eng,"Out-of-bounds memory access",
|
||||
"Load or store into an out-of-bound memory position.") {}
|
||||
|
||||
void FlushReportsImpl(BugReporter& BR, GRExprEngine& Eng) {
|
||||
Emit(BR, Eng.explicit_oob_memacc_begin(), Eng.explicit_oob_memacc_end());
|
||||
}
|
||||
};
|
||||
|
||||
} // end clang namespace
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
@ -388,7 +377,6 @@ void GRExprEngine::RegisterInternalChecks() {
|
|||
BR.Register(new UndefResult(this));
|
||||
BR.Register(new BadMsgExprArg(this));
|
||||
BR.Register(new BadReceiver(this));
|
||||
BR.Register(new OutOfBoundMemoryAccess(this));
|
||||
BR.Register(new NilReceiverStructRet(this));
|
||||
BR.Register(new NilReceiverLargerThanVoidPtrRet(this));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue