clang  7.0.0svn
Functions
BugReporterVisitors.cpp File Reference
#include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprObjC.h"
#include "clang/Analysis/CFGStmtMap.h"
#include "clang/Lex/Lexer.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
#include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/raw_ostream.h"
Include dependency graph for BugReporterVisitors.cpp:

Go to the source code of this file.

Functions

static StringRef getMacroName (SourceLocation Loc, BugReporterContext &BRC)
 
static bool isFunctionMacroExpansion (SourceLocation Loc, const SourceManager &SM)
 
static bool isInitializationOfVar (const ExplodedNode *N, const VarRegion *VR)
 Returns true if N represents the DeclStmt declaring and initializing VR. More...
 
void showBRDiagnostics (const char *action, llvm::raw_svector_ostream &os, const MemRegion *R, SVal V, const DeclStmt *DS)
 Show diagnostics for initializing or declaring a region R with a bad value. More...
 
static void showBRParamDiagnostics (llvm::raw_svector_ostream &os, const VarRegion *VR, SVal V)
 Display diagnostics for passing bad region as a parameter. More...
 
static void showBRDefaultDiagnostics (llvm::raw_svector_ostream &os, const MemRegion *R, SVal V)
 Show default diagnostics for storing bad region. More...
 
static const MemRegiongetLocationRegionIfReference (const Expr *E, const ExplodedNode *N)
 
static const ExprpeelOffOuterExpr (const Expr *Ex, const ExplodedNode *N)
 
static const ExplodedNodefindNodeForStatement (const ExplodedNode *N, const Stmt *S, const Expr *Inner)
 Walk through nodes until we get one that matches the statement exactly. More...
 
static const ExplodedNodefindNodeForExpression (const ExplodedNode *N, const Expr *Inner)
 Find the ExplodedNode where the lvalue (the value of 'Ex') was computed. More...
 
static const ExprpeelOfOuterAddrOf (const Expr *Ex)
 Performing operator `&' on an lvalue expression is essentially a no-op. More...
 

Function Documentation

◆ findNodeForExpression()

static const ExplodedNode* findNodeForExpression ( const ExplodedNode N,
const Expr Inner 
)
static

Find the ExplodedNode where the lvalue (the value of 'Ex') was computed.

Definition at line 1116 of file BugReporterVisitors.cpp.

References clang::ProgramPoint::getAs(), clang::ento::ExplodedNode::getFirstPred(), clang::ento::ExplodedNode::getLocation(), and P.

◆ findNodeForStatement()

static const ExplodedNode* findNodeForStatement ( const ExplodedNode N,
const Stmt S,
const Expr Inner 
)
static

Walk through nodes until we get one that matches the statement exactly.

Alternately, if we hit a known lvalue for the statement, we know we've gone too far (though we can likely track the lvalue better anyway).

Definition at line 1096 of file BugReporterVisitors.cpp.

◆ getLocationRegionIfReference()

static const MemRegion* getLocationRegionIfReference ( const Expr E,
const ExplodedNode N 
)
static

Definition at line 1030 of file BugReporterVisitors.cpp.

◆ getMacroName()

static StringRef getMacroName ( SourceLocation  Loc,
BugReporterContext BRC 
)
static

◆ isFunctionMacroExpansion()

static bool isFunctionMacroExpansion ( SourceLocation  Loc,
const SourceManager SM 
)
static

◆ isInitializationOfVar()

static bool isInitializationOfVar ( const ExplodedNode N,
const VarRegion VR 
)
static

◆ peelOffOuterExpr()

static const Expr* peelOffOuterExpr ( const Expr Ex,
const ExplodedNode N 
)
static

◆ peelOfOuterAddrOf()

static const Expr* peelOfOuterAddrOf ( const Expr Ex)
static

Performing operator `&' on an lvalue expression is essentially a no-op.

Then, if we are taking addresses of fields or elements, these are also unlikely to matter.

Definition at line 1133 of file BugReporterVisitors.cpp.

References clang::ento::bugreporter::getDerefExpr(), and clang::Expr::IgnoreParenCasts().

◆ showBRDefaultDiagnostics()

static void showBRDefaultDiagnostics ( llvm::raw_svector_ostream &  os,
const MemRegion R,
SVal  V 
)
static

◆ showBRDiagnostics()

void showBRDiagnostics ( const char *  action,
llvm::raw_svector_ostream &  os,
const MemRegion R,
SVal  V,
const DeclStmt DS 
)

◆ showBRParamDiagnostics()

static void showBRParamDiagnostics ( llvm::raw_svector_ostream &  os,
const VarRegion VR,
SVal  V 
)
static