Go to the documentation of this file.
15 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CALLDESCRIPTION_H
16 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CALLDESCRIPTION_H
19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/ADT/Optional.h"
21 #include "llvm/Support/Compiler.h"
50 std::vector<std::string> QualifiedName;
84 return std::next(QualifiedName.rbegin());
112 template <
typename... Ts>
150 template <
typename... Ts>
159 bool matchesImpl(
const FunctionDecl *Callee,
size_t ArgCount,
160 size_t ParamCount)
const;
173 std::vector<std::pair<CallDescription, T>> LinearMap;
177 std::initializer_list<std::pair<CallDescription, T>> &&List)
180 template <
typename InputIt>
196 for (
const std::pair<CallDescription, T> &I : LinearMap)
197 if (I.first.matches(Call))
218 for (
const std::pair<CallDescription, T> &I : LinearMap)
219 if (I.first.matchesAsWritten(Call))
258 #endif // LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_CALLDESCRIPTION_H
CallDescriptionMap(std::initializer_list< std::pair< CallDescription, T >> &&List)
auto end_qualified_name_parts() const
friend bool matchesAny(const CallEvent &Call, const CallDescription &CD1, const Ts &...CDs)
Returns true whether the CallEvent matches on any of the CallDescriptions supplied.
CallDescription(CallDescriptionFlags Flags, ArrayRef< const char * > QualifiedName, MaybeCount RequiredArgs=None, MaybeCount RequiredParams=None)
Constructs a CallDescription object.
CallDescriptionSet & operator=(const CallDescription &)=delete
bool matchesAsWritten(const CallExpr &CE) const
Returns true if the CallExpr is a call to a function that matches the CallDescription.
bool matches(const CallEvent &Call) const
Returns true if the CallEvent is a call to a function that matches the CallDescription.
const LLVM_NODISCARD T * lookup(const CallEvent &Call) const
bool hasQualifiedNameParts() const
It's false, if and only if we expect a single identifier, such as getenv.
StringRef getFunctionName() const
Get the name of the function that this object matches.
const LLVM_NODISCARD T * lookupAsWritten(const CallExpr &Call) const
When available, always prefer lookup with a CallEvent! This function exists only when that is not ava...
CallDescriptionMap(InputIt First, InputIt Last)
CallDescriptionMap & operator=(const CallDescription &)=delete
auto begin_qualified_name_parts() const
Get the qualified name parts in reversed order.
friend bool matchesAnyAsWritten(const CallExpr &CE, const CallDescription &CD1, const Ts &...CDs)
Returns true whether the CallExpr matches on any of the CallDescriptions supplied.
LLVM_NODISCARD bool contains(const CallEvent &Call) const
@ CDF_MaybeBuiltin
Describes a C standard function that is sometimes implemented as a macro that expands to a compiler b...
LLVM_NODISCARD bool containsAsWritten(const CallExpr &CE) const
When available, always prefer lookup with a CallEvent! This function exists only when that is not ava...
friend bool matchesAnyAsWritten(const CallExpr &CE, const CallDescription &CD1)
Returns true whether the CallExpr matches on any of the CallDescriptions supplied.
Represents an abstract call to a function or method along a particular path.
~CallDescriptionMap()=default
This class represents a description of a function call using the number of arguments and the name of ...
An immutable set of CallDescriptions.
An immutable map from CallDescriptions to arbitrary data.
Represents a function declaration or definition.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
friend bool matchesAny(const CallEvent &Call, const CallDescription &CD1)
Returns true whether the CallEvent matches on any of the CallDescriptions supplied.
CallDescriptionSet(std::initializer_list< CallDescription > &&List)