17#ifndef LLVM_CLANG_ASTMATCHERS_DYNAMIC_VARIANTVALUE_H
18#define LLVM_CLANG_ASTMATCHERS_DYNAMIC_VARIANTVALUE_H
22#include "llvm/ADT/IntrusiveRefCntPtr.h"
28namespace ast_matchers {
77 return NodeKind <
Other.NodeKind;
90using ast_matchers::internal::DynTypedMatcher;
109 MatcherOps(
ASTNodeKind NodeKind) : NodeKind(NodeKind) {}
111 bool canConstructFrom(
const DynTypedMatcher &Matcher,
112 bool &IsExactMatch)
const;
116 DynTypedMatcher convertMatcher(
const DynTypedMatcher &Matcher)
const;
121 std::optional<DynTypedMatcher>
122 constructVariadicOperator(DynTypedMatcher::VariadicOperator Op,
135 virtual std::optional<DynTypedMatcher> getSingleMatcher()
const = 0;
136 virtual std::string getTypeAsString()
const = 0;
137 virtual std::optional<DynTypedMatcher>
140 unsigned *Specificity)
const = 0;
161 std::vector<VariantMatcher> Args);
190 if (!
Value)
return false;
191 return Value->getTypedMatcher(MatcherOps(NK)).has_value();
202 return Value->isConvertibleTo(
Kind, Specificity);
212 assert(hasTypedMatcher<T>() &&
"hasTypedMatcher<T>() == false");
213 return Value->getTypedMatcher(MatcherOps(ASTNodeKind::getFromNodeKind<T>()))
214 ->template convertTo<T>();
219 return *
Value->getTypedMatcher(MatcherOps(NK));
234 class PolymorphicPayload;
235 class VariadicOpPayload;
237 std::shared_ptr<const Payload>
Value;
347 VariantMatcher *Matcher;
enum clang::sema::@1655::IndirectLocalPathEntry::EntryKind Kind
The base class of the type hierarchy.
bool operator<(const ArgKind &Other) const
static ArgKind MakeMatcherArg(ASTNodeKind MatcherKind)
Constructor for matcher types.
std::string asString() const
String representation of the type.
static ArgKind MakeNodeArg(ASTNodeKind MatcherKind)
bool isConvertibleTo(ArgKind To, unsigned *Specificity) const
Determines if this type can be converted to To.
ASTNodeKind getMatcherKind() const
ASTNodeKind getNodeKind() const
ArgKind(Kind K)
Constructor for non-matcher types.
A variant matcher object.
ast_matchers::internal::Matcher< T > getTypedMatcher() const
Return this matcher as a Matcher<T>.
static VariantMatcher PolymorphicMatcher(std::vector< DynTypedMatcher > Matchers)
Clones the provided matchers.
DynTypedMatcher getTypedMatcher(ASTNodeKind NK) const
VariantMatcher()
A null matcher.
bool hasTypedMatcher(ASTNodeKind NK) const
bool hasTypedMatcher() const
Determines if the contained matcher can be converted to Matcher<T>.
void reset()
Makes the matcher the "null" matcher.
std::optional< DynTypedMatcher > getSingleMatcher() const
Return a single matcher, if there is no ambiguity.
bool isNull() const
Whether the matcher is null.
std::string getTypeAsString() const
String representation of the type of the value.
bool isConvertibleTo(ASTNodeKind Kind, unsigned *Specificity) const
Determines if the contained matcher can be converted to Kind.
static VariantMatcher VariadicOperatorMatcher(DynTypedMatcher::VariadicOperator Op, std::vector< VariantMatcher > Args)
Creates a 'variadic' operator matcher.
static VariantMatcher SingleMatcher(const DynTypedMatcher &Matcher)
Clones the provided matcher.
VariantValue(int Signed)
Constructs an unsigned value (disambiguation from bool).
bool isString() const
String value functions.
void setNodeKind(ASTNodeKind NodeKind)
unsigned getUnsigned() const
void setBoolean(bool Boolean)
const ASTNodeKind & getNodeKind() const
const std::string & getString() const
bool isUnsigned() const
Unsigned value functions.
void setDouble(double Double)
std::string getTypeAsString() const
String representation of the type of the value.
bool isConvertibleTo(ArgKind Kind, unsigned *Specificity) const
Determines if the contained value can be converted to Kind.
void setString(StringRef String)
void setUnsigned(unsigned Unsigned)
const VariantMatcher & getMatcher() const
bool isMatcher() const
Matcher value functions.
bool isBoolean() const
Boolean value functions.
void setMatcher(const VariantMatcher &Matcher)
VariantValue & operator=(const VariantValue &Other)
bool isDouble() const
Double value functions.
The JSON file list parser is used to communicate input to InstallAPI.
@ Other
Other implicit parameter.