14 #ifndef LLVM_CLANG_AST_COMPARISONCATEGORIES_H 15 #define LLVM_CLANG_AST_COMPARISONCATEGORIES_H 18 #include "llvm/ADT/APSInt.h" 19 #include "llvm/ADT/DenseMap.h" 81 : Ctx(Ctx), Record(RD), Kind(Kind) {}
88 : Kind(Kind), VD(VD) {}
92 bool hasValidIntValue()
const;
104 ValueInfo,
static_cast<unsigned>(ComparisonCategoryResult::Last) + 1>
127 ValueInfo *Info = lookupValueInfo(ValueKind);
129 "comparison category does not contain the specified result kind");
131 "couldn't determine the integer constant for this value");
139 return Kind == CCK::StrongOrdering;
145 return Kind == CCK::PartialOrdering;
153 if (!isStrong() && Res == CCR::Equal)
154 return CCR::Equivalent;
159 return getValueInfo(makeWeakResult(ComparisonCategoryResult::Equal));
162 return getValueInfo(ComparisonCategoryResult::Less);
165 return getValueInfo(ComparisonCategoryResult::Greater);
169 return getValueInfo(ComparisonCategoryResult::Unordered);
180 static std::vector<ComparisonCategoryResult>
187 assert(Result !=
nullptr &&
188 "information for specified comparison category has not been built");
207 const auto &
This = *
this;
222 mutable llvm::DenseMap<char, ComparisonCategoryInfo> Data;
A (possibly-)qualified type.
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
ComparisonCategoryType Kind
The Kind of the comparison category type.
The base class of the type hierarchy.
Represent a C++ namespace.
Represents a variable declaration or definition.
bool This(InterpState &S, CodePtr OpPC)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
ComparisonCategoryResult
An enumeration representing the possible results of a three-way comparison.
bool isPartial() const
True iff the comparison is not totally ordered.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const ValueInfo * getValueInfo(ComparisonCategoryResult ValueKind) const
Sema - This implements semantic analysis and AST building for C.
bool hasValidIntValue() const
True iff we've successfully evaluated the variable as a constant expression and extracted its integer...
const ValueInfo * getGreater() const
const ValueInfo * getLess() const
Optional< ComparisonCategoryType > getComparisonCategoryForBuiltinCmp(QualType T)
Get the comparison category that should be used when comparing values of type T.
ComparisonCategoryInfo * lookupInfo(ComparisonCategoryType Kind)
Dataflow Directional Tag Classes.
ComparisonCategoryInfo(const ASTContext &Ctx, CXXRecordDecl *RD, ComparisonCategoryType Kind)
Represents a C++ struct/union/class.
bool isStrong() const
True iff the comparison is "strong".
const ValueInfo * getEqualOrEquiv() const
const ComparisonCategoryInfo & getInfo(ComparisonCategoryType Kind) const
Return the comparison category information for the category specified by 'Kind'.
ValueInfo(ComparisonCategoryResult Kind, VarDecl *VD)
ComparisonCategoryType
An enumeration representing the different comparison categories types.
const ValueInfo * getUnordered() const
ComparisonCategoryType commonComparisonType(ComparisonCategoryType A, ComparisonCategoryType B)
Determine the common comparison type, as defined in C++2a [class.spaceship]p4.
ComparisonCategoryResult Kind
ComparisonCategoryResult makeWeakResult(ComparisonCategoryResult Res) const
Converts the specified result kind into the the correct result kind for this category.