clang  8.0.0svn
Functions
BugReporterVisitors.cpp File Reference
#include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/Type.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Analysis/AnalysisDeclContext.h"
#include "clang/Analysis/CFG.h"
#include "clang/Analysis/CFGStmtMap.h"
#include "clang/Analysis/ProgramPoint.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
#include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
#include "clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.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/MemRegion.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SMTConv.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <deque>
#include <memory>
#include <string>
#include <utility>

Go to the source code of this file.

Functions

static const ExprpeelOffPointerArithmetic (const BinaryOperator *B)
 
static StringRef getMacroName (SourceLocation Loc, BugReporterContext &BRC)
 
static bool isFunctionMacroExpansion (SourceLocation Loc, const SourceManager &SM)
 
static bool wasRegionOfInterestModifiedAt (const SubRegion *RegionOfInterest, const ExplodedNode *N, SVal ValueAfter)
 
static bool isInitializationOfVar (const ExplodedNode *N, const VarRegion *VR)
 Returns true if N represents the DeclStmt declaring and initializing VR. More...
 
static 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 MemRegion * getLocationRegionIfReference (const Expr *E, const ExplodedNode *N)
 

Function Documentation

◆ getLocationRegionIfReference()

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

◆ getMacroName()

static StringRef getMacroName ( SourceLocation  Loc,
BugReporterContext &  BRC 
)
static
Returns
name of the macro inside the location Loc.

Definition at line 209 of file BugReporterVisitors.cpp.

References clang::Lexer::getImmediateMacroName().

◆ isFunctionMacroExpansion()

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

◆ isInitializationOfVar()

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

Returns true if N represents the DeclStmt declaring and initializing VR.

Definition at line 1028 of file BugReporterVisitors.cpp.

References clang::DeclStmt::getSingleDecl(), clang::LocationContext::getStackFrame(), and P.

Referenced by showBRDefaultDiagnostics().

◆ peelOffPointerArithmetic()

static const Expr* peelOffPointerArithmetic ( const BinaryOperator B)
static

◆ showBRDefaultDiagnostics()

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

Show default diagnostics for storing bad region.

Definition at line 1128 of file BugReporterVisitors.cpp.

References clang::CallEventManager::getCaller(), clang::Expr::IgnoreParenCasts(), isInitializationOfVar(), and P.

◆ showBRDiagnostics()

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

Show diagnostics for initializing or declaring a region R with a bad value.

Definition at line 1056 of file BugReporterVisitors.cpp.

References clang::DeclStmt::getSingleDecl().

◆ showBRParamDiagnostics()

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

Display diagnostics for passing bad region as a parameter.

Definition at line 1098 of file BugReporterVisitors.cpp.

◆ wasRegionOfInterestModifiedAt()

static bool wasRegionOfInterestModifiedAt ( const SubRegion *  RegionOfInterest,
const ExplodedNode *  N,
SVal  ValueAfter 
)
static