18 using namespace clang;
37 if (isa<ObjCMethodDecl>(D) || isa<CXXMethodDecl>(D))
39 if (isa<BlockDecl>(D))
40 return "anonymous block";
54 if (BName.find(Name) != StringRef::npos)
78 StringRef FName = II->
getName();
79 if (FName.equals(Name))
82 if (FName.startswith(
"__inline") && (FName.find(Name) != StringRef::npos))
85 if (FName.startswith(
"__") && FName.endswith(
"_chk") &&
86 FName.find(Name) != StringRef::npos)
103 if (LHSVal.isUnknownOrUndef())
105 ProgramStateManager &Mgr = State->getStateManager();
106 if (!LHSVal.getAs<NonLoc>()) {
107 LHSVal = Mgr.getStoreManager().getBinding(State->getStore(),
108 LHSVal.castAs<Loc>());
109 if (LHSVal.isUnknownOrUndef() || !LHSVal.getAs<NonLoc>())
113 SValBuilder &Bldr = Mgr.getSValBuilder();
114 SVal Eval = Bldr.evalBinOp(State, ComparisonOp, LHSVal, RHSVal,
115 Bldr.getConditionType());
116 if (Eval.isUnknownOrUndef())
119 std::tie(StTrue, StFalse) = State->assume(Eval.castAs<DefinedSVal>());
120 return StTrue && !StFalse;
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...
Represents a function declaration or definition.
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
Decl - This represents one declaration (or definition), e.g.
IntrusiveRefCntPtr< const ProgramState > ProgramStateRef
StringRef getDeclDescription(const Decl *D)
Returns the word that should be used to refer to the declaration in the report.
const FunctionDecl * getCalleeDecl(const CallExpr *CE) const
Get the declaration of the called function (path-sensitive).
SVal getSVal(const Stmt *S) const
Get the value of arbitrary expressions at this point in the path.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getCalleeName(const FunctionDecl *FunDecl) const
Get the name of the called function (path-sensitive).
One of these records is kept for each identifier that is lexed.
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.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
const SourceManager & getSourceManager()
const char * getName(unsigned ID) const
Return the identifier name for the specified builtin, e.g.
This represents one expression.
static bool isCLibraryFunction(const FunctionDecl *FD, StringRef Name=StringRef())
Returns true if the callee is an externally-visible function in the top-level namespace, such as malloc.
DeclContext * getDeclContext()
Encodes a location in the source.
static bool evalComparison(SVal LHSVal, BinaryOperatorKind ComparisonOp, SVal RHSVal, ProgramStateRef State)
Evaluate comparison and return true if it's known that condition is true.
ASTContext & getASTContext() const LLVM_READONLY
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
SVal getSVal(const Stmt *S) const
Get the value of an arbitrary expression at this node.
static StringRef getImmediateMacroName(SourceLocation Loc, const SourceManager &SM, const LangOptions &LangOpts)
Retrieve the name of the immediate macro expansion.
StringRef getName() const
Return the actual identifier string.
Dataflow Directional Tag Classes.
ASTContext & getASTContext()
StringRef getMacroNameOrSpelling(SourceLocation &Loc)
Depending on wither the location corresponds to a macro, return either the macro name or the token sp...
const FunctionDecl * getAsFunctionDecl() const
getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a CodeTextRegion wrapping a FunctionDecl...
const ProgramStateRef & getState() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
bool isNegative(const Expr *E)
Returns true if the value of E is negative.
Builtin::Context & BuiltinInfo
SValBuilder & getSValBuilder()
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
bool isTranslationUnit() const
Defines enum values for all the target-independent builtin functions.
const LangOptions & getLangOpts() const
bool isExternallyVisible() const