Go to the documentation of this file.
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"
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;
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;
Optional< ComparisonCategoryType > getComparisonCategoryForBuiltinCmp(QualType T)
Get the comparison category that should be used when comparing values of type T.
YAML serialization mapping.
bool hasValidIntValue() const
True iff we've successfully evaluated the variable as a constant expression and extracted its integer...
A (possibly-)qualified type.
const ComparisonCategoryInfo & getInfoForType(QualType Ty) const
Return the comparison category information as specified by getCategoryForType(Ty).
bool isStrong() const
True iff the comparison is "strong".
llvm::APSInt getIntValue() const
Get the constant integer value used by this variable to represent the comparison category result type...
const ValueInfo * getUnordered() const
The base class of the type hierarchy.
const CXXRecordDecl * Record
The declaration for the comparison category type from the standard library.
ValueInfo(ComparisonCategoryResult Kind, VarDecl *VD)
static std::vector< ComparisonCategoryResult > getPossibleResultsForType(ComparisonCategoryType Type)
Return the list of results which are valid for the specified comparison category type.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
ComparisonCategoryType commonComparisonType(ComparisonCategoryType A, ComparisonCategoryType B)
Determine the common comparison type, as defined in C++2a [class.spaceship]p4.
ComparisonCategoryType
An enumeration representing the different comparison categories types.
const ComparisonCategoryInfo * lookupInfoForType(QualType Ty) const
Represents a variable declaration or definition.
ComparisonCategoryInfo * lookupInfo(ComparisonCategoryType Kind)
const ComparisonCategoryInfo * lookupInfo(ComparisonCategoryType Kind) const
Return the cached comparison category information for the specified 'Kind'.
Represents a C++ struct/union/class.
ComparisonCategoryResult Kind
const ValueInfo * getValueInfo(ComparisonCategoryResult ValueKind) const
ComparisonCategoryInfo(const ASTContext &Ctx, CXXRecordDecl *RD, ComparisonCategoryType Kind)
static StringRef getCategoryString(ComparisonCategoryType Kind)
Sema - This implements semantic analysis and AST building for C.
bool isPartial() const
True iff the comparison is not totally ordered.
const ComparisonCategoryInfo & getInfo(ComparisonCategoryType Kind) const
Return the comparison category information for the category specified by 'Kind'.
bool This(InterpState &S, CodePtr OpPC)
const ValueInfo * getEqualOrEquiv() const
ComparisonCategoryResult makeWeakResult(ComparisonCategoryResult Res) const
Converts the specified result kind into the correct result kind for this category.
ComparisonCategoryResult
An enumeration representing the possible results of a three-way comparison.
ComparisonCategoryType Kind
The Kind of the comparison category type.
const ValueInfo * getLess() const
static StringRef getResultString(ComparisonCategoryResult Kind)
const ValueInfo * getGreater() const
Represent a C++ namespace.