clang 22.0.0git
|
#include "clang/Analysis/Analyses/UnsafeBufferUsage.h"
#include "clang/AST/APValue.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTTypeTraits.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DynamicRecursiveASTVisitor.h"
#include "clang/AST/Expr.h"
#include "clang/AST/FormatString.h"
#include "clang/AST/ParentMapContext.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/Type.h"
#include "clang/ASTMatchers/LowLevelHelpers.h"
#include "clang/Analysis/Support/FixitUtil.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include <cstddef>
#include <optional>
#include <queue>
#include <set>
#include <sstream>
#include "clang/Analysis/Analyses/UnsafeBufferUsageGadgets.def"
Go to the source code of this file.
Classes | |
class | MatchDescendantVisitor |
struct | libc_func_matchers::LibcFunNamePrefixSuffixParser |
class | UPCPreIncrementGadget |
class | UUCAddAssignGadget |
class | DerefSimplePtrArithFixableGadget |
class | WarningGadgetMatcher |
class | FixableGadgetMatcher |
struct | CompareNode< NodeTy > |
struct | WarningGadgetSets |
struct | FixableGadgetSets |
class | VariableGroupsManagerImpl |
Namespaces | |
namespace | libc_func_matchers |
Macros | |
#define | SIZED_CONTAINER_OR_VIEW_LIST |
#define | GADGET(x) |
#define | GADGET(x) |
#define | WARNING_GADGET(name) |
#define | WARNING_OPTIONAL_GADGET(name) |
#define | FIXABLE_GADGET(name) |
#define | DEBUG_NOTE_DECL_FAIL(D, Msg) |
Functions | |
static bool | hasPointerType (const Expr &E) |
static bool | hasArrayType (const Expr &E) |
static void | forEachDescendantEvaluatedStmt (const Stmt *S, ASTContext &Ctx, const UnsafeBufferUsageHandler &Handler, FastMatcher &Matcher) |
static void | forEachDescendantStmt (const Stmt *S, ASTContext &Ctx, const UnsafeBufferUsageHandler &Handler, FastMatcher &Matcher) |
static bool | notInSafeBufferOptOut (const Stmt &Node, const UnsafeBufferUsageHandler *Handler) |
static bool | ignoreUnsafeBufferInContainer (const Stmt &Node, const UnsafeBufferUsageHandler *Handler) |
static bool | ignoreUnsafeLibcCall (const ASTContext &Ctx, const Stmt &Node, const UnsafeBufferUsageHandler *Handler) |
static void | findStmtsInUnspecifiedLvalueContext (const Stmt *S, const llvm::function_ref< void(const Expr *)> OnResult) |
static void | findStmtsInUnspecifiedPointerContext (const Stmt *S, llvm::function_ref< void(const Stmt *)> InnerMatcher) |
static void | findStmtsInUnspecifiedUntypedContext (const Stmt *S, llvm::function_ref< void(const Stmt *)> InnerMatcher) |
static bool | areEqualIntegers (const Expr *E1, const Expr *E2, ASTContext &Ctx) |
static bool | areEqualIntegralBinaryOperators (const BinaryOperator *E1, const Expr *E2_LHS, BinaryOperatorKind BOP, const Expr *E2_RHS, ASTContext &Ctx) |
static bool | isPtrBufferSafe (const Expr *Ptr, const Expr *Size, ASTContext &Ctx) |
static bool | isSafeSpanTwoParamConstruct (const CXXConstructExpr &Node, ASTContext &Ctx) |
static bool | isSafeArraySubscript (const ArraySubscriptExpr &Node, const ASTContext &Ctx) |
static bool | libc_func_matchers::isNullTermPointer (const Expr *Ptr) |
static bool | libc_func_matchers::hasUnsafeFormatOrSArg (const CallExpr *Call, const Expr *&UnsafeArg, const unsigned FmtArgIdx, ASTContext &Ctx, bool isKprintf=false) |
static bool | libc_func_matchers::isPredefinedUnsafeLibcFunc (const FunctionDecl &Node) |
static bool | libc_func_matchers::isUnsafeVaListPrintfFunc (const FunctionDecl &Node) |
static bool | libc_func_matchers::isUnsafeSprintfFunc (const FunctionDecl &Node) |
static bool | libc_func_matchers::isNormalPrintfFunc (const FunctionDecl &Node) |
static bool | libc_func_matchers::hasUnsafePrintfStringArg (const CallExpr &Node, ASTContext &Ctx, MatchResult &Result, llvm::StringRef Tag) |
static bool | libc_func_matchers::hasUnsafeSnprintfBuffer (const CallExpr &Node, ASTContext &Ctx) |
static void | findGadgets (const Stmt *S, ASTContext &Ctx, const UnsafeBufferUsageHandler &Handler, bool EmitSuggestions, FixableGadgetList &FixableGadgets, WarningGadgetList &WarningGadgets, DeclUseTracker &Tracker) |
static WarningGadgetSets | groupWarningGadgetsByVar (const WarningGadgetList &AllUnsafeOperations) |
static FixableGadgetSets | groupFixablesByVar (FixableGadgetList &&AllFixableOperations) |
static std::optional< FixItList > | createDataFixit (const ASTContext &Ctx, const DeclRefExpr *DRE) |
static bool | isNonNegativeIntegerExpr (const Expr *Expr, const VarDecl *VD, const ASTContext &Ctx) |
static std::optional< FixItList > | fixUPCAddressofArraySubscriptWithSpan (const UnaryOperator *Node) |
static StringRef | getEndOfLine () |
static std::string | getUserFillPlaceHolder (StringRef HintTextToUser="placeholder") |
template<typename NodeTy> | |
static std::optional< SourceLocation > | getEndCharLoc (const NodeTy *Node, const SourceManager &SM, const LangOptions &LangOpts) |
static bool | hasUnsupportedSpecifiers (const VarDecl *VD, const SourceManager &SM) |
static SourceRange | getSourceRangeToTokenEnd (const Decl *D, const SourceManager &SM, const LangOptions &LangOpts) |
static std::optional< StringRef > | getFunNameText (const FunctionDecl *FD, const SourceManager &SM, const LangOptions &LangOpts) |
static std::string | getSpanTypeText (StringRef EltTyText, std::optional< Qualifiers > Quals=std::nullopt) |
static std::optional< FixItList > | FixVarInitializerWithSpan (const Expr *Init, ASTContext &Ctx, const StringRef UserFillPlaceHolder) |
static std::optional< std::string > | createSpanTypeForVarDecl (const VarDecl *VD, const ASTContext &Ctx) |
static FixItList | fixLocalVarDeclWithSpan (const VarDecl *D, ASTContext &Ctx, const StringRef UserFillPlaceHolder, UnsafeBufferUsageHandler &Handler) |
static bool | hasConflictingOverload (const FunctionDecl *FD) |
static std::optional< FixItList > | createOverloadsForFixedParams (const FixitStrategy &S, const FunctionDecl *FD, const ASTContext &Ctx, UnsafeBufferUsageHandler &Handler) |
static FixItList | fixParamWithSpan (const ParmVarDecl *PVD, const ASTContext &Ctx, UnsafeBufferUsageHandler &Handler) |
static FixItList | fixVariableWithSpan (const VarDecl *VD, const DeclUseTracker &Tracker, ASTContext &Ctx, UnsafeBufferUsageHandler &Handler) |
static FixItList | fixVarDeclWithArray (const VarDecl *D, const ASTContext &Ctx, UnsafeBufferUsageHandler &Handler) |
static FixItList | fixVariableWithArray (const VarDecl *VD, const DeclUseTracker &Tracker, const ASTContext &Ctx, UnsafeBufferUsageHandler &Handler) |
static FixItList | fixVariable (const VarDecl *VD, FixitStrategy::Kind K, const Decl *D, const DeclUseTracker &Tracker, ASTContext &Ctx, UnsafeBufferUsageHandler &Handler) |
static bool | overlapWithMacro (const FixItList &FixIts) |
static bool | isParameterOf (const VarDecl *VD, const Decl *D) |
static void | eraseVarsForUnfixableGroupMates (std::map< const VarDecl *, FixItList > &FixItsForVariable, const VariableGroupsManager &VarGrpMgr) |
static FixItList | createFunctionOverloadsForParms (std::map< const VarDecl *, FixItList > &FixItsForVariable, const VariableGroupsManager &VarGrpMgr, const FunctionDecl *FD, const FixitStrategy &S, ASTContext &Ctx, UnsafeBufferUsageHandler &Handler) |
static std::map< const VarDecl *, FixItList > | getFixIts (FixableGadgetSets &FixablesForAllVars, const FixitStrategy &S, ASTContext &Ctx, const Decl *D, const DeclUseTracker &Tracker, UnsafeBufferUsageHandler &Handler, const VariableGroupsManager &VarGrpMgr) |
template<typename VarDeclIterTy> | |
static FixitStrategy | getNaiveStrategy (llvm::iterator_range< VarDeclIterTy > UnsafeVars) |
static void | applyGadgets (const Decl *D, FixableGadgetList FixableGadgets, WarningGadgetList WarningGadgets, DeclUseTracker Tracker, UnsafeBufferUsageHandler &Handler, bool EmitSuggestions) |
#define DEBUG_NOTE_DECL_FAIL | ( | D, | |
Msg ) |
Definition at line 3321 of file UnsafeBufferUsage.cpp.
Referenced by fixLocalVarDeclWithSpan(), fixParamWithSpan(), fixVarDeclWithArray(), fixVariable(), and fixVariableWithSpan().
#define FIXABLE_GADGET | ( | name | ) |
#define GADGET | ( | x | ) |
Definition at line 1234 of file UnsafeBufferUsage.cpp.
#define GADGET | ( | x | ) |
Definition at line 1234 of file UnsafeBufferUsage.cpp.
#define SIZED_CONTAINER_OR_VIEW_LIST |
Definition at line 119 of file UnsafeBufferUsage.cpp.
Referenced by isPtrBufferSafe(), and isSafeSpanTwoParamConstruct().
#define WARNING_GADGET | ( | name | ) |
#define WARNING_OPTIONAL_GADGET | ( | name | ) |
|
static |
Definition at line 4064 of file UnsafeBufferUsage.cpp.
References clang::UnsafeBufferUsageHandler::addDebugNoteForVar(), FixableGadgetSets::byVar, WarningGadgetSets::byVar, clang::Decl::getASTContext(), clang::DeclaratorDecl::getBeginLoc(), getFixIts(), getNaiveStrategy(), clang::NamedDecl::getNameAsString(), groupFixablesByVar(), groupWarningGadgetsByVar(), clang::UnsafeBufferUsageHandler::handleUnsafeVariableGroup(), clang::isa(), isParameterOf(), WarningGadgetSets::noVar, and V.
Referenced by clang::checkUnsafeBufferUsage().
|
static |
Definition at line 432 of file UnsafeBufferUsage.cpp.
References areEqualIntegralBinaryOperators(), clang::cast(), clang::Expr::EvaluateAsInt(), clang::APValue::getInt(), clang::Stmt::getStmtClass(), clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isIntegerType(), and clang::Expr::EvalResult::Val.
Referenced by areEqualIntegralBinaryOperators(), and isSafeSpanTwoParamConstruct().
|
static |
Definition at line 411 of file UnsafeBufferUsage.cpp.
References areEqualIntegers(), clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOpcode(), and clang::BinaryOperator::getRHS().
Referenced by areEqualIntegers(), and isSafeSpanTwoParamConstruct().
|
inlinestatic |
Definition at line 3083 of file UnsafeBufferUsage.cpp.
References clang::FixItHint::CreateInsertion(), clang::ASTContext::getLangOpts(), clang::getPastLoc(), clang::ASTContext::getSourceManager(), and SM.
|
static |
Definition at line 3894 of file UnsafeBufferUsage.cpp.
References createOverloadsForFixedParams(), clang::VariableGroupsManager::getGroupOfParms(), and clang::Member.
Referenced by getFixIts().
|
static |
Definition at line 3452 of file UnsafeBufferUsage.cpp.
References clang::FixItHint::CreateInsertion(), clang::DeclaratorDecl::getBeginLoc(), clang::Stmt::getBeginLoc(), clang::FunctionDecl::getBody(), getEndOfLine(), getFunNameText(), clang::NamedDecl::getIdentifier(), clang::ASTContext::getLangOpts(), clang::IdentifierInfo::getName(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::getPastLoc(), clang::getPointeeTypeText(), clang::getRangeText(), clang::ASTContext::getSourceManager(), getSourceRangeToTokenEnd(), getSpanTypeText(), clang::UnsafeBufferUsageHandler::getUnsafeBufferUsageAttributeTextAt(), getUserFillPlaceHolder(), hasConflictingOverload(), clang::Decl::isImplicit(), clang::FixitStrategy::lookup(), clang::FunctionDecl::param_begin(), clang::FunctionDecl::redecls(), SM, clang::FixitStrategy::Span, and clang::FixitStrategy::Wontfix.
Referenced by createFunctionOverloadsForParms().
|
static |
Definition at line 3333 of file UnsafeBufferUsage.cpp.
References clang::ASTContext::getLangOpts(), clang::getPointeeTypeText(), clang::ASTContext::getSourceManager(), clang::ValueDecl::getType(), and clang::Type::isPointerType().
Referenced by fixLocalVarDeclWithSpan(), and fixParamWithSpan().
|
static |
Definition at line 3865 of file UnsafeBufferUsage.cpp.
References clang::VariableGroupsManager::getGroupOfVar(), and clang::Member.
Referenced by getFixIts().
|
static |
Definition at line 2601 of file UnsafeBufferUsage.cpp.
References forEachDescendantEvaluatedStmt(), and forEachDescendantStmt().
Referenced by clang::checkUnsafeBufferUsage(), and clang::findUnsafePointers().
|
static |
Definition at line 302 of file UnsafeBufferUsage.cpp.
References clang::BinaryOperator::getLHS(), and clang::BinaryOperator::getOpcode().
Referenced by DerefSimplePtrArithFixableGadget::matches().
|
static |
Definition at line 314 of file UnsafeBufferUsage.cpp.
References clang::BinaryOperator::getLHS(), clang::BinaryOperator::getOpcode(), clang::BinaryOperator::getRHS(), hasPointerType(), clang::Type::isAnyPointerType(), and clang::ast_matchers::matchEachArgumentWithParamType().
Referenced by UPCPreIncrementGadget::matches().
|
static |
Definition at line 383 of file UnsafeBufferUsage.cpp.
Referenced by UUCAddAssignGadget::matches().
|
static |
Definition at line 3369 of file UnsafeBufferUsage.cpp.
References clang::FixItHint::CreateReplacement(), createSpanTypeForVarDecl(), DEBUG_NOTE_DECL_FAIL, FixVarInitializerWithSpan(), clang::DeclaratorDecl::getBeginLoc(), clang::VarDecl::getInit(), clang::SourceLocation::getLocWithOffset(), clang::ASTContext::getSourceManager(), clang::DeclaratorDecl::getTypeSpecEndLoc(), clang::getVarDeclIdentifierLoc(), hasUnsupportedSpecifiers(), clang::Init, and clang::SourceLocation::isValid().
Referenced by fixVariableWithSpan().
|
static |
Definition at line 3619 of file UnsafeBufferUsage.cpp.
References clang::FixItHint::CreateReplacement(), createSpanTypeForVarDecl(), DEBUG_NOTE_DECL_FAIL, clang::Qualifiers::getAsString(), clang::NamedDecl::getIdentifier(), clang::ASTContext::getLangOpts(), clang::IdentifierInfo::getName(), clang::getPointeeTypeText(), clang::QualType::getQualifiers(), clang::ASTContext::getSourceManager(), clang::ParmVarDecl::getSourceRange(), getSpanTypeText(), clang::ValueDecl::getType(), clang::ParmVarDecl::hasDefaultArg(), clang::QualType::hasQualifiers(), and hasUnsupportedSpecifiers().
Referenced by fixVariable().
|
static |
Definition at line 3121 of file UnsafeBufferUsage.cpp.
References clang::cast(), clang::FixItHint::CreateReplacement(), clang::Decl::getASTContext(), clang::DeclRefExpr::getDecl(), clang::getExprText(), clang::Expr::getIntegerConstantExpr(), clang::ASTContext::getLangOpts(), clang::ASTContext::getSourceManager(), clang::Stmt::getSourceRange(), clang::UnaryOperator::getSubExpr(), and SM.
|
static |
Definition at line 3688 of file UnsafeBufferUsage.cpp.
References clang::FixItHint::CreateReplacement(), DEBUG_NOTE_DECL_FAIL, clang::Lexer::findNextToken(), clang::ASTContext::getAsConstantArrayType(), clang::DeclaratorDecl::getBeginLoc(), clang::QualType::getCanonicalType(), clang::SourceRange::getEnd(), clang::ASTContext::getLangOpts(), clang::SourceLocation::getLocWithOffset(), clang::getRangeText(), clang::ASTContext::getSourceManager(), clang::VarDecl::getSourceRange(), clang::ValueDecl::getType(), clang::DeclaratorDecl::getTypeSpecEndLoc(), clang::getVarDeclIdentifierLoc(), clang::getVarDeclIdentifierText(), clang::isa(), and clang::QualType::isNull().
Referenced by fixVariableWithArray().
|
static |
Definition at line 3784 of file UnsafeBufferUsage.cpp.
References clang::FixitStrategy::Array, DEBUG_NOTE_DECL_FAIL, fixParamWithSpan(), fixVariableWithArray(), fixVariableWithSpan(), clang::ASTContext::getAsConstantArrayType(), clang::ValueDecl::getType(), clang::isa(), clang::VarDecl::isLocalVarDecl(), clang::Type::isPointerType(), clang::FixitStrategy::Iterator, clang::FixitStrategy::Span, clang::FunctionDecl::TK_NonTemplate, clang::FixitStrategy::Vector, and clang::FixitStrategy::Wontfix.
Referenced by getFixIts().
|
static |
Definition at line 3762 of file UnsafeBufferUsage.cpp.
References fixVarDeclWithArray(), and clang::DeclStmt::isSingleDecl().
Referenced by fixVariable().
|
static |
Definition at line 3664 of file UnsafeBufferUsage.cpp.
References DEBUG_NOTE_DECL_FAIL, fixLocalVarDeclWithSpan(), getUserFillPlaceHolder(), and clang::DeclStmt::isSingleDecl().
Referenced by fixVariable().
|
static |
Definition at line 3243 of file UnsafeBufferUsage.cpp.
References clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::ASTContext::getAsConstantArrayType(), getEndCharLoc(), clang::getExprText(), clang::ASTContext::getLangOpts(), clang::getPastLoc(), clang::ASTContext::getSourceManager(), clang::Init, and SM.
Referenced by fixLocalVarDeclWithSpan().
|
static |
Definition at line 265 of file UnsafeBufferUsage.cpp.
References clang::DynTypedNode::create(), and MatchDescendantVisitor::findMatch().
Referenced by findGadgets().
|
static |
Definition at line 273 of file UnsafeBufferUsage.cpp.
References clang::DynTypedNode::create(), and MatchDescendantVisitor::findMatch().
Referenced by findGadgets().
|
static |
Definition at line 2909 of file UnsafeBufferUsage.cpp.
References clang::SourceLocation::getLocWithOffset(), clang::SourceLocation::isValid(), clang::Lexer::MeasureTokenLength(), and SM.
Referenced by FixVarInitializerWithSpan(), UPCPreIncrementGadget::getFixits(), and UUCAddAssignGadget::getFixits().
|
static |
Definition at line 2892 of file UnsafeBufferUsage.cpp.
Referenced by createOverloadsForFixedParams().
|
static |
Definition at line 3918 of file UnsafeBufferUsage.cpp.
References clang::UnsafeBufferUsageHandler::addDebugNoteForVar(), clang::internal::anyConflict(), FixableGadgetSets::byVar, createFunctionOverloadsForParms(), eraseVarsForUnfixableGroupMates(), fixVariable(), clang::VariableGroupsManager::getGroupOfVar(), clang::ASTContext::getSourceManager(), clang::FixitStrategy::lookup(), and overlapWithMacro().
Referenced by applyGadgets().
|
static |
Definition at line 2959 of file UnsafeBufferUsage.cpp.
References clang::DeclarationNameInfo::getBeginLoc(), clang::NestedNameSpecifierLoc::getBeginLoc(), clang::DeclarationNameInfo::getEndLoc(), clang::Lexer::getLocForEndOfToken(), clang::FunctionDecl::getNameInfo(), clang::DeclaratorDecl::getQualifier(), clang::DeclaratorDecl::getQualifierLoc(), clang::getRangeText(), and SM.
Referenced by createOverloadsForFixedParams().
|
static |
Definition at line 4018 of file UnsafeBufferUsage.cpp.
References clang::FixitStrategy::Array, clang::QualType::getCanonicalType(), clang::ValueDecl::getType(), clang::isa(), clang::FixitStrategy::set(), and clang::FixitStrategy::Span.
Referenced by applyGadgets().
|
static |
Definition at line 2946 of file UnsafeBufferUsage.cpp.
References clang::Decl::getBeginLoc(), clang::Decl::getEndLoc(), clang::Lexer::getLocForEndOfToken(), and SM.
Referenced by createOverloadsForFixedParams().
|
static |
Definition at line 2980 of file UnsafeBufferUsage.cpp.
Referenced by createOverloadsForFixedParams(), and fixParamWithSpan().
|
static |
Definition at line 2899 of file UnsafeBufferUsage.cpp.
References s.
Referenced by createOverloadsForFixedParams(), and fixVariableWithSpan().
|
static |
Definition at line 2711 of file UnsafeBufferUsage.cpp.
References FixableGadgetSets::byVar, and clang::DeclRefExpr::getDecl().
Referenced by applyGadgets().
|
static |
Definition at line 2679 of file UnsafeBufferUsage.cpp.
References WarningGadgetSets::byVar, clang::DeclRefExpr::getDecl(), and WarningGadgetSets::noVar.
Referenced by applyGadgets().
Definition at line 260 of file UnsafeBufferUsage.cpp.
References clang::QualType::getCanonicalType(), clang::Expr::getType(), and clang::isa().
|
static |
Definition at line 3416 of file UnsafeBufferUsage.cpp.
References clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::DeclContextLookupResult::isSingleResult(), and clang::DeclContext::lookup().
Referenced by createOverloadsForFixedParams().
Definition at line 256 of file UnsafeBufferUsage.cpp.
References clang::QualType::getCanonicalType(), clang::Expr::getType(), and clang::isa().
Referenced by findStmtsInUnspecifiedPointerContext(), DerefSimplePtrArithFixableGadget::matches(), and UUCAddAssignGadget::matches().
|
static |
Definition at line 2927 of file UnsafeBufferUsage.cpp.
References clang::Decl::attrs(), clang::VarDecl::hasConstantInitialization(), clang::VarDecl::hasLocalStorage(), clang::VarDecl::isConstexpr(), clang::VarDecl::isInlineSpecified(), and SM.
Referenced by fixLocalVarDeclWithSpan(), and fixParamWithSpan().
|
static |
Definition at line 288 of file UnsafeBufferUsage.cpp.
References clang::Stmt::getBeginLoc(), and clang::UnsafeBufferUsageHandler::ignoreUnsafeBufferInContainer().
|
static |
Definition at line 293 of file UnsafeBufferUsage.cpp.
References clang::Stmt::getBeginLoc(), clang::ASTContext::getLangOpts(), and clang::UnsafeBufferUsageHandler::ignoreUnsafeBufferInLibcCall().
|
static |
Definition at line 2832 of file UnsafeBufferUsage.cpp.
References clang::Expr::getIntegerConstantExpr(), clang::Expr::getType(), and clang::Type::isUnsignedIntegerType().
Referenced by UUCAddAssignGadget::getFixits().
Definition at line 3857 of file UnsafeBufferUsage.cpp.
References clang::Decl::getDeclContext(), and clang::isa().
Referenced by applyGadgets().
|
static |
Definition at line 474 of file UnsafeBufferUsage.cpp.
References clang::ASTContext::getAsConstantArrayType(), clang::APValue::getInt(), clang::UnaryOperator::getOpcode(), clang::Type::getPointeeType(), clang::Expr::getType(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isCharType(), SIZED_CONTAINER_OR_VIEW_LIST, and clang::Expr::EvalResult::Val.
Referenced by libc_func_matchers::hasUnsafeFormatOrSArg(), libc_func_matchers::hasUnsafeSnprintfBuffer(), and isSafeSpanTwoParamConstruct().
|
static |
Definition at line 669 of file UnsafeBufferUsage.cpp.
References clang::Expr::EvaluateAsInt(), clang::ArraySubscriptExpr::getBase(), clang::ArraySubscriptExpr::getIdx(), clang::APValue::getInt(), clang::Expr::getType(), clang::Type::getUnqualifiedDesugaredType(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isUnsignedIntegerType(), clang::Expr::isValueDependent(), and clang::Expr::EvalResult::Val.
|
static |
Definition at line 565 of file UnsafeBufferUsage.cpp.
References areEqualIntegers(), areEqualIntegralBinaryOperators(), clang::Call, clang::cast(), clang::CXXConstructExpr::getArg(), clang::ParamIdx::getASTIndex(), clang::Expr::getIntegerConstantExpr(), clang::CXXConstructExpr::getNumArgs(), clang::Type::getPointeeType(), clang::Stmt::getStmtClass(), clang::ASTContext::getTypeSizeInChars(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isConstantSizeType(), clang::CharUnits::isOne(), isPtrBufferSafe(), clang::ParamIdx::isValid(), and SIZED_CONTAINER_OR_VIEW_LIST.
|
static |
Definition at line 282 of file UnsafeBufferUsage.cpp.
References clang::Stmt::getBeginLoc(), and clang::UnsafeBufferUsageHandler::isSafeBufferOptOut().
|
static |
Definition at line 3844 of file UnsafeBufferUsage.cpp.
References clang::FixItHint::RemoveRange.
Referenced by getFixIts().