clang  6.0.0svn
Functions
clang::ento::bugreporter Namespace Reference

Functions

bool trackNullOrUndefValue (const ExplodedNode *N, const Stmt *S, BugReport &R, bool IsArg=false, bool EnableNullFPSuppression=true)
 Attempts to add visitors to trace a null or undefined value back to its point of origin, whether it is a symbol constrained to null or an explicit assignment. More...
 
const ExprgetDerefExpr (const Stmt *S)
 Given that expression S represents a pointer that would be dereferenced, try to find a sub-expression from which the pointer came from. More...
 
const StmtGetDenomExpr (const ExplodedNode *N)
 
const StmtGetRetValExpr (const ExplodedNode *N)
 
bool isDeclRefExprToReference (const Expr *E)
 

Function Documentation

◆ GetDenomExpr()

const Stmt * clang::ento::bugreporter::GetDenomExpr ( const ExplodedNode N)

Definition at line 121 of file BugReporterVisitors.cpp.

◆ getDerefExpr()

const Expr * clang::ento::bugreporter::getDerefExpr ( const Stmt S)

Given that expression S represents a pointer that would be dereferenced, try to find a sub-expression from which the pointer came from.

This is used for tracking down origins of a null or undefined value: "this is null because that is null because that is null" etc. We wipe away field and element offsets because they merely add offsets. We also wipe away all casts except lvalue-to-rvalue casts, because the latter represent an actual pointer dereference; however, we remove the final lvalue-to-rvalue cast before returning from this function because it demonstrates more clearly from where the pointer rvalue was loaded. Examples: x->y.z ==> x (lvalue) foo()->y.z ==> foo() (rvalue)

Definition at line 57 of file BugReporterVisitors.cpp.

Referenced by emitBug().

◆ GetRetValExpr()

const Stmt * clang::ento::bugreporter::GetRetValExpr ( const ExplodedNode N)

Definition at line 128 of file BugReporterVisitors.cpp.

◆ isDeclRefExprToReference()

bool clang::ento::bugreporter::isDeclRefExprToReference ( const Expr E)

Definition at line 38 of file BugReporterVisitors.cpp.

◆ trackNullOrUndefValue()

bool clang::ento::bugreporter::trackNullOrUndefValue ( const ExplodedNode N,
const Stmt S,
BugReport R,
bool  IsArg = false,
bool  EnableNullFPSuppression = true 
)

Attempts to add visitors to trace a null or undefined value back to its point of origin, whether it is a symbol constrained to null or an explicit assignment.

Parameters
NA node "downstream" from the evaluation of the statement.
SThe statement whose value is null or undefined.
RThe bug report to which visitors should be attached.
IsArgWhether the statement is an argument to an inlined function. If this is the case, N must be the CallEnter node for the function.
EnableNullFPSuppressionWhether we should employ false positive suppression (inlined defensive checks, returned null).
Returns
Whether or not the function was able to add visitors for this statement. Note that returning true does not actually imply that any visitors were added.

Definition at line 981 of file BugReporterVisitors.cpp.

Referenced by describeUninitializedArgumentInCall(), emitBug(), GetCFNumberSize(), and clang::ento::FindLastStoreBRVisitor::VisitNode().