14#ifndef LLVM_CLANG_ANALYSIS_ANALYSES_UNSAFEBUFFERUSAGE_H
15#define LLVM_CLANG_ANALYSIS_ANALYSES_UNSAFEBUFFERUSAGE_H
20#include "llvm/Support/Debug.h"
38 bool *HasParm =
nullptr)
const =0;
60 using MapTy = llvm::DenseMap<const VarDecl *, Kind>;
74 auto I = Map.find(VD);
91 using DebugNote = std::pair<SourceLocation, std::string>;
111 bool IsRelatedToDecl,
129 DEBUG_WITH_TYPE(
"SafeBuffers",
return true);
156 StringRef WSSuffix =
"")
const = 0;
162 bool EmitSuggestions);
llvm::DenseMap< Stmt *, Stmt * > MapTy
Defines the clang::SourceLocation class and associated facilities.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Decl - This represents one declaration (or definition), e.g.
FixitStrategy(FixitStrategy &&)=default
FixitStrategy & operator=(const FixitStrategy &)=delete
FixitStrategy & operator=(FixitStrategy &&)=default
FixitStrategy(const FixitStrategy &)=delete
Kind lookup(const VarDecl *VD) const
void set(const VarDecl *VD, Kind K)
Encodes a location in the source.
This class handles loading and caching of source files into memory.
Stmt - This represents one statement.
The interface that lets the caller handle unsafe buffer usage analysis results by overriding this cla...
DebugNoteByVar DebugNotesByVar
bool areDebugNotesRequested()
void addDebugNoteForVar(const VarDecl *VD, SourceLocation Loc, std::string Text)
std::vector< DebugNote > DebugNoteList
virtual std::string getUnsafeBufferUsageAttributeTextAt(SourceLocation Loc, StringRef WSSuffix="") const =0
virtual bool isSafeBufferOptOut(const SourceLocation &Loc) const =0
std::map< const VarDecl *, DebugNoteList > DebugNoteByVar
std::pair< SourceLocation, std::string > DebugNote
virtual bool ignoreUnsafeBufferInContainer(const SourceLocation &Loc) const =0
virtual void handleUnsafeOperation(const Stmt *Operation, bool IsRelatedToDecl, ASTContext &Ctx)=0
Invoked when an unsafe operation over raw pointers is found.
UnsafeBufferUsageHandler()=default
virtual void handleUnsafeVariableGroup(const VarDecl *Variable, const VariableGroupsManager &VarGrpMgr, FixItList &&Fixes, const Decl *D, const FixitStrategy &VarTargetTypes)=0
Invoked when a fix is suggested against a variable.
virtual ~UnsafeBufferUsageHandler()=default
virtual void handleUnsafeOperationInContainer(const Stmt *Operation, bool IsRelatedToDecl, ASTContext &Ctx)=0
Invoked when an unsafe operation with a std container is found.
Represents a variable declaration or definition.
virtual ~VariableGroupsManager()=default
VariableGroupsManager()=default
virtual VarGrpRef getGroupOfVar(const VarDecl *Var, bool *HasParm=nullptr) const =0
Returns the set of variables (including Var) that need to be fixed together in one step.
virtual VarGrpRef getGroupOfParms() const =0
Returns the non-empty group of variables that include parameters of the analyzing function,...
bool anyConflict(const llvm::SmallVectorImpl< FixItHint > &FixIts, const SourceManager &SM)
The JSON file list parser is used to communicate input to InstallAPI.
void checkUnsafeBufferUsage(const Decl *D, UnsafeBufferUsageHandler &Handler, bool EmitSuggestions)
std::vector< const VarDecl * > VarGrpTy