14#ifndef LLVM_CLANG_ANALYSIS_ANALYSES_UNSAFEBUFFERUSAGE_H
15#define LLVM_CLANG_ANALYSIS_ANALYSES_UNSAFEBUFFERUSAGE_H
19#include "llvm/Support/Debug.h"
37 bool *HasParm =
nullptr)
const =0;
53 using DebugNote = std::pair<SourceLocation, std::string>;
69 bool IsRelatedToDecl) = 0;
84 DEBUG_WITH_TYPE(
"SafeBuffers",
return true);
106 StringRef WSSuffix =
"")
const = 0;
112 bool EmitSuggestions);
Decl - This represents one declaration (or definition), e.g.
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...
virtual void handleUnsafeOperation(const Stmt *Operation, bool IsRelatedToDecl)=0
Invoked when an unsafe operation over raw pointers is found.
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
Returns a reference to the Preprocessor:
std::map< const VarDecl *, DebugNoteList > DebugNoteByVar
std::pair< SourceLocation, std::string > DebugNote
UnsafeBufferUsageHandler()=default
virtual void handleUnsafeVariableGroup(const VarDecl *Variable, const VariableGroupsManager &VarGrpMgr, FixItList &&Fixes, const Decl *D)=0
Invoked when a fix is suggested against a variable.
virtual ~UnsafeBufferUsageHandler()=default
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)
void checkUnsafeBufferUsage(const Decl *D, UnsafeBufferUsageHandler &Handler, bool EmitSuggestions)
std::vector< const VarDecl * > VarGrpTy