clang 20.0.0git
|
The interface that lets the caller handle unsafe buffer usage analysis results by overriding this class's handle... methods. More...
#include "clang/Analysis/Analyses/UnsafeBufferUsage.h"
Public Types | |
using | DebugNote = std::pair< SourceLocation, std::string > |
using | DebugNoteList = std::vector< DebugNote > |
using | DebugNoteByVar = std::map< const VarDecl *, DebugNoteList > |
using | FixItList = llvm::SmallVectorImpl< FixItHint > |
This analyses produces large fixits that are organized into lists of primitive fixits (individual insertions/removals/replacements). | |
Public Member Functions | |
UnsafeBufferUsageHandler ()=default | |
virtual | ~UnsafeBufferUsageHandler ()=default |
virtual void | handleUnsafeOperation (const Stmt *Operation, bool IsRelatedToDecl, ASTContext &Ctx)=0 |
Invoked when an unsafe operation over raw pointers is found. | |
virtual void | handleUnsafeLibcCall (const CallExpr *Call, unsigned PrintfInfo, ASTContext &Ctx, const Expr *UnsafeArg=nullptr)=0 |
Invoked when a call to an unsafe libc function is found. | |
virtual void | handleUnsafeOperationInContainer (const Stmt *Operation, bool IsRelatedToDecl, ASTContext &Ctx)=0 |
Invoked when an unsafe operation with a std container is found. | |
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. | |
bool | areDebugNotesRequested () |
void | addDebugNoteForVar (const VarDecl *VD, SourceLocation Loc, std::string Text) |
void | clearDebugNotes () |
virtual bool | isSafeBufferOptOut (const SourceLocation &Loc) const =0 |
virtual bool | ignoreUnsafeBufferInContainer (const SourceLocation &Loc) const =0 |
virtual bool | ignoreUnsafeBufferInLibcCall (const SourceLocation &Loc) const =0 |
virtual std::string | getUnsafeBufferUsageAttributeTextAt (SourceLocation Loc, StringRef WSSuffix="") const =0 |
Public Attributes | |
DebugNoteByVar | DebugNotesByVar |
The interface that lets the caller handle unsafe buffer usage analysis results by overriding this class's handle... methods.
Definition at line 85 of file UnsafeBufferUsage.h.
using clang::UnsafeBufferUsageHandler::DebugNote = std::pair<SourceLocation, std::string> |
Definition at line 92 of file UnsafeBufferUsage.h.
using clang::UnsafeBufferUsageHandler::DebugNoteByVar = std::map<const VarDecl *, DebugNoteList> |
Definition at line 94 of file UnsafeBufferUsage.h.
using clang::UnsafeBufferUsageHandler::DebugNoteList = std::vector<DebugNote> |
Definition at line 93 of file UnsafeBufferUsage.h.
This analyses produces large fixits that are organized into lists of primitive fixits (individual insertions/removals/replacements).
Definition at line 104 of file UnsafeBufferUsage.h.
|
default |
|
virtualdefault |
|
inline |
Definition at line 148 of file UnsafeBufferUsage.h.
References areDebugNotesRequested(), DebugNotesByVar, Loc, and Text.
Referenced by applyGadgets(), and getFixIts().
|
inline |
Definition at line 143 of file UnsafeBufferUsage.h.
Referenced by addDebugNoteForVar(), and clearDebugNotes().
|
inline |
Definition at line 154 of file UnsafeBufferUsage.h.
References areDebugNotesRequested(), and DebugNotesByVar.
Referenced by clang::checkUnsafeBufferUsage().
|
pure virtual |
Referenced by createOverloadsForFixedParams().
|
pure virtual |
Invoked when a call to an unsafe libc function is found.
PrintfInfo | is 0 if the callee function is not a member of the printf family; is 1 if the callee is sprintf ; is 2 if arguments of the call have __size_by relation but are not in a safe pattern; is 3 if string arguments do not guarantee null-termination is 4 if the callee takes va_list |
UnsafeArg | one of the actual arguments that is unsafe, non-null only when 2 <= PrintfInfo <= 3 |
|
pure virtual |
Invoked when an unsafe operation over raw pointers is found.
|
pure virtual |
Invoked when an unsafe operation with a std container is found.
|
pure virtual |
Invoked when a fix is suggested against a variable.
This function groups all variables that must be fixed together (i.e their types must be changed to the same target type to prevent type mismatches) into a single fixit.
D
is the declaration of the callable under analysis that owns Variable
and all of its group mates.
Referenced by applyGadgets().
|
pure virtual |
Loc
; false otherwise.
|
pure virtual |
Loc
|
pure virtual |
Loc
; false otherwise. DebugNoteByVar clang::UnsafeBufferUsageHandler::DebugNotesByVar |
Definition at line 95 of file UnsafeBufferUsage.h.
Referenced by addDebugNoteForVar(), and clearDebugNotes().