Go to the documentation of this file.
18 using namespace clang;
41 if (isa<ObjCMethodDecl, CXXMethodDecl>(D))
43 if (isa<BlockDecl>(D))
44 return "anonymous block";
58 size_t start = BName.find(Name);
59 if (start != StringRef::npos) {
61 if (BName.size() == Name.size())
69 const auto MatchPredecessor = [=]() ->
bool {
70 return start <= 0 || !llvm::isAlpha(BName[start - 1]);
72 const auto MatchSuccessor = [=]() ->
bool {
74 return LookbehindPlace >= BName.size() ||
75 !llvm::isAlpha(BName[LookbehindPlace]);
78 if (MatchPredecessor() && MatchSuccessor())
103 StringRef FName = II->
getName();
104 if (FName.equals(Name))
107 if (FName.startswith(
"__inline") && FName.contains(Name))
110 if (FName.startswith(
"__") && FName.endswith(
"_chk") && FName.contains(Name))
127 if (LHSVal.isUnknownOrUndef())
129 ProgramStateManager &Mgr =
State->getStateManager();
130 if (!LHSVal.getAs<NonLoc>()) {
131 LHSVal = Mgr.getStoreManager().getBinding(
State->getStore(),
132 LHSVal.castAs<Loc>());
133 if (LHSVal.isUnknownOrUndef() || !LHSVal.getAs<NonLoc>())
137 SValBuilder &Bldr = Mgr.getSValBuilder();
138 SVal Eval = Bldr.evalBinOp(
State, ComparisonOp, LHSVal, RHSVal,
139 Bldr.getConditionType());
140 if (Eval.isUnknownOrUndef())
143 std::tie(StTrue, StFalse) =
State->assume(Eval.castAs<DefinedSVal>());
144 return StTrue && !StFalse;
ASTContext & getASTContext() const LLVM_READONLY
const FunctionDecl * getAsFunctionDecl() const
getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a CodeTextRegion wrapping a FunctionDecl...
StringRef getDeclDescription(const Decl *D)
Returns the word that should be used to refer to the declaration in the report.
bool isExternallyVisible() const
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,...
Encodes a location in the source.
Builtin::Context & BuiltinInfo
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
const FunctionDecl * getCalleeDecl(const CallExpr *CE) const
Get the declaration of the called function (path-sensitive).
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.
const ProgramStateRef & getState() const
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
static bool evalComparison(SVal LHSVal, BinaryOperatorKind ComparisonOp, SVal RHSVal, ProgramStateRef State)
Evaluate comparison and return true if it's known that condition is true.
StringRef getCalleeName(const FunctionDecl *FunDecl) const
Get the name of the called function (path-sensitive).
bool isTranslationUnit() const
StringRef getMacroNameOrSpelling(SourceLocation &Loc)
Depending on wither the location corresponds to a macro, return either the macro name or the token sp...
static StringRef getImmediateMacroName(SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
Retrieve the name of the immediate macro expansion.
const SourceManager & getSourceManager()
const LangOptions & getLangOpts() const
SValBuilder & getSValBuilder()
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
ASTContext & getASTContext()
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
const char * getName(unsigned ID) const
Return the identifier name for the specified builtin, e.g.
Decl - This represents one declaration (or definition), e.g.
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
One of these records is kept for each identifier that is lexed.
static bool isCLibraryFunction(const FunctionDecl *FD, StringRef Name=StringRef())
Returns true if the callee is an externally-visible function in the top-level namespace,...
StringRef getName() const
Return the actual identifier string.
bool isNegative(const Expr *E)
Returns true if the value of E is negative.
SVal getSVal(const Stmt *S) const
Get the value of an arbitrary expression at this node.
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
This represents one expression.
SVal getSVal(const Stmt *S) const
Get the value of arbitrary expressions at this point in the path.
Represents a function declaration or definition.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
DeclContext * getDeclContext()