diff options
Diffstat (limited to 'include/clang/ASTMatchers/Dynamic/VariantValue.h')
-rw-r--r-- | include/clang/ASTMatchers/Dynamic/VariantValue.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/clang/ASTMatchers/Dynamic/VariantValue.h b/include/clang/ASTMatchers/Dynamic/VariantValue.h index c5426dd75ef5..f9efe0f16f43 100644 --- a/include/clang/ASTMatchers/Dynamic/VariantValue.h +++ b/include/clang/ASTMatchers/Dynamic/VariantValue.h @@ -35,6 +35,8 @@ class ArgKind { public: enum Kind { AK_Matcher, + AK_Boolean, + AK_Double, AK_Unsigned, AK_String }; @@ -241,6 +243,8 @@ struct VariantMatcher::TypedMatcherOps final : VariantMatcher::MatcherOps { /// copy/assignment. /// /// Supported types: +/// - \c bool +// - \c double /// - \c unsigned /// - \c llvm::StringRef /// - \c VariantMatcher (\c DynTypedMatcher / \c Matcher<T>) @@ -253,14 +257,29 @@ public: VariantValue &operator=(const VariantValue &Other); /// \brief Specific constructors for each supported type. + VariantValue(bool Boolean); + VariantValue(double Double); VariantValue(unsigned Unsigned); VariantValue(StringRef String); VariantValue(const VariantMatcher &Matchers); + /// \brief Constructs an \c unsigned value (disambiguation from bool). + VariantValue(int Signed) : VariantValue(static_cast<unsigned>(Signed)) {} + /// \brief Returns true iff this is not an empty value. explicit operator bool() const { return hasValue(); } bool hasValue() const { return Type != VT_Nothing; } + /// \brief Boolean value functions. + bool isBoolean() const; + bool getBoolean() const; + void setBoolean(bool Boolean); + + /// \brief Double value functions. + bool isDouble() const; + double getDouble() const; + void setDouble(double Double); + /// \brief Unsigned value functions. bool isUnsigned() const; unsigned getUnsigned() const; @@ -303,6 +322,8 @@ private: /// \brief All supported value types. enum ValueType { VT_Nothing, + VT_Boolean, + VT_Double, VT_Unsigned, VT_String, VT_Matcher @@ -311,6 +332,8 @@ private: /// \brief All supported value types. union AllValues { unsigned Unsigned; + double Double; + bool Boolean; std::string *String; VariantMatcher *Matcher; }; |