17#include "llvm/ADT/StringExtras.h"
42 if (isa<ObjCMethodDecl, CXXMethodDecl>(
D))
44 if (isa<BlockDecl>(
D))
45 return "anonymous block";
59 size_t start = BName.find(Name);
60 if (start != StringRef::npos) {
62 if (BName.size() == Name.size())
70 const auto MatchPredecessor = [=]() ->
bool {
71 return start <= 0 || !llvm::isAlpha(BName[start - 1]);
73 const auto MatchSuccessor = [=]() ->
bool {
74 std::size_t LookbehindPlace = start + Name.size();
75 return LookbehindPlace >= BName.size() ||
76 !llvm::isAlpha(BName[LookbehindPlace]);
79 if (MatchPredecessor() && MatchSuccessor())
106 StringRef FName = II->
getName();
110 if (FName.starts_with(
"__inline") && FName.contains(Name))
122 auto CompletelyMatchesParts = [II](
auto... Parts) ->
bool {
123 StringRef FName = II->
getName();
124 return (FName.consume_front(Parts) && ...) && FName.empty();
127 return CompletelyMatchesParts(
"__", Name,
"_chk") ||
128 CompletelyMatchesParts(
"__builtin_",
"__", Name,
"_chk");
145 if (!isa<NonLoc>(LHSVal)) {
153 SVal Eval = Bldr.
evalBinOp(State, ComparisonOp, LHSVal, RHSVal,
159 return StTrue && !StFalse;
Defines enum values for all the target-independent builtin functions.
static bool evalComparison(SVal LHSVal, BinaryOperatorKind ComparisonOp, SVal RHSVal, ProgramStateRef State)
Evaluate comparison and return true if it's known that condition is true.
Builtin::Context & BuiltinInfo
llvm::StringRef getName(unsigned ID) const
Return the identifier name for the specified builtin, e.g.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isTranslationUnit() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
bool isStdNamespace() const
Decl - This represents one declaration (or definition), e.g.
ASTContext & getASTContext() const LLVM_READONLY
DeclContext * getDeclContext()
This represents one expression.
Represents a function declaration or definition.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
One of these records is kept for each identifier that is lexed.
StringRef getName() const
Return the actual identifier string.
static StringRef getImmediateMacroName(SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
Retrieve the name of the immediate macro expansion.
static unsigned getSpelling(const Token &Tok, const char *&Buffer, const SourceManager &SourceMgr, const LangOptions &LangOpts, bool *Invalid=nullptr)
getSpelling - This method is used to get the spelling of a token into a preallocated buffer,...
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
bool isExternallyVisible() const
Encodes a location in the source.
StringRef getDeclDescription(const Decl *D)
Returns the word that should be used to refer to the declaration in the report.
const SourceManager & getSourceManager()
SValBuilder & getSValBuilder()
StringRef getCalleeName(const FunctionDecl *FunDecl) const
Get the name of the called function (path-sensitive).
ASTContext & getASTContext()
const ProgramStateRef & getState() const
SVal getSVal(const Stmt *S) const
Get the value of arbitrary expressions at this point in the path.
bool isNegative(const Expr *E)
Returns true if the value of E is negative.
bool isGreaterOrEqual(const Expr *E, unsigned long long Val)
Returns true if the value of E is greater than or equal to Val under unsigned comparison.
static bool isCLibraryFunction(const FunctionDecl *FD, StringRef Name=StringRef())
Returns true if the given function is an externally-visible function in the top-level namespace,...
const FunctionDecl * getCalleeDecl(const CallExpr *CE) const
Get the declaration of the called function (path-sensitive).
StringRef getMacroNameOrSpelling(SourceLocation &Loc)
Depending on wither the location corresponds to a macro, return either the macro name or the token sp...
const LangOptions & getLangOpts() const
static bool isHardenedVariantOf(const FunctionDecl *FD, StringRef Name)
In builds that use source hardening (-D_FORTIFY_SOURCE), many standard functions are implemented as m...
SVal getSVal(const Stmt *S) const
Get the value of an arbitrary expression at this node.
SValBuilder & getSValBuilder()
StoreManager & getStoreManager()
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
QualType getConditionType() const
SVal evalBinOp(ProgramStateRef state, BinaryOperator::Opcode op, SVal lhs, SVal rhs, QualType type)
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
bool isUnknownOrUndef() const
const FunctionDecl * getAsFunctionDecl() const
getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a CodeTextRegion wrapping a FunctionDecl...
T castAs() const
Convert to the specified SVal type, asserting that this SVal is of the desired type.
virtual SVal getBinding(Store store, Loc loc, QualType T=QualType())=0
Return the value bound to specified location in a given state.
The JSON file list parser is used to communicate input to InstallAPI.