15 #ifndef LLVM_CLANG_AST_COMPARISONCATEGORIES_H 16 #define LLVM_CLANG_AST_COMPARISONCATEGORIES_H 19 #include "llvm/ADT/APSInt.h" 20 #include "llvm/ADT/DenseMap.h" 75 : Ctx(Ctx), Record(RD), Kind(Kind) {}
82 : Kind(Kind), VD(VD) {}
86 bool hasValidIntValue()
const;
90 llvm::APSInt getIntValue()
const;
98 ValueInfo,
static_cast<unsigned>(ComparisonCategoryResult::Last) + 1>
121 ValueInfo *Info = lookupValueInfo(ValueKind);
123 "comparison category does not contain the specified result kind");
125 "couldn't determine the integer constant for this value");
135 return Kind == CCK::PartialOrdering || Kind == CCK::WeakOrdering ||
136 Kind == CCK::StrongOrdering;
143 return Kind == CCK::StrongEquality || Kind == CCK::StrongOrdering;
149 return Kind == CCK::PartialOrdering;
158 if (Res == CCR::Equal)
159 return CCR::Equivalent;
160 if (Res == CCR::Nonequal)
161 return CCR::Nonequivalent;
167 return getValueInfo(makeWeakResult(ComparisonCategoryResult::Equal));
170 assert(isEquality());
171 return getValueInfo(makeWeakResult(ComparisonCategoryResult::Nonequal));
175 return getValueInfo(ComparisonCategoryResult::Less);
179 return getValueInfo(ComparisonCategoryResult::Greater);
183 return getValueInfo(ComparisonCategoryResult::Unordered);
194 static std::vector<ComparisonCategoryResult>
201 assert(Result !=
nullptr &&
202 "information for specified comparison category has not been built");
221 const auto &This = *
this;
237 mutable llvm::DenseMap<char, ComparisonCategoryInfo> Data;
A (possibly-)qualified type.
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
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.
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...
bool isEquality() const
True iff the comparison category is an equality comparison.
const ValueInfo * getValueInfo(ComparisonCategoryResult ValueKind) const
Sema - This implements semantic analysis and AST building for C.
const ValueInfo * getNonequalOrNonequiv() const
bool hasValidIntValue() const
True iff we've successfully evaluated the variable as a constant expression and extracted its integer...
const ValueInfo * getGreater() const
bool isOrdered() const
True iff the comparison category is a relational comparison.
const ValueInfo * getLess() const
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
ComparisonCategoryResult Kind
ComparisonCategoryResult makeWeakResult(ComparisonCategoryResult Res) const
Converts the specified result kind into the the correct result kind for this category.