;
24std::optional<ComparisonCategoryType>
29 returnCCT::StrongOrdering;
32 returnCCT::PartialOrdering;
38 returnCCT::StrongOrdering;
45assert(
VD&&
"must have var decl");
52 if(std::distance(
Record->field_begin(),
Record->field_end()) != 1 ||
53!
Record->field_begin()->getType()->isIntegralOrEnumerationType())
68assert(hasValidIntValue() &&
"must have a valid value");
69 returnVD->evaluateValue()->getStructField(0).getInt();
75 autoIt = llvm::find_if(
76Objects, [&](
ValueInfo const&Info) {
returnInfo.
Kind== ValueKind; });
77 if(It != Objects.end())
84 if(Lookup.
empty() || !isa<VarDecl>(Lookup.
front()))
86Objects.emplace_back(ValueKind, cast<VarDecl>(Lookup.
front()));
87 return&Objects.back();
95 if(!Lookup.
empty())
96StdNS = dyn_cast<NamespaceDecl>(Lookup.
front());
106 if(!Lookup.
empty())
114 autoIt =
Data.find(
static_cast<char>(
Kind));
115 if(It !=
Data.end())
120 return&
Data.try_emplace((
char)
Kind, Ctx, RD,
Kind).first->second;
127assert(!Ty.
isNull() &&
"type must be non-null");
135 for(
const auto&KV :
Data) {
141 if(!RD->getEnclosingNamespaceContext()->isStdNamespace())
146 for(
unsignedI =
static_cast<unsigned>(CCT::First),
147End =
static_cast<unsigned>(CCT::Last);
149CCT
Kind=
static_cast<CCT
>(I);
153 if(getCategoryString(
Kind) == RD->getName())
154 return&
Data.try_emplace((
char)
Kind, Ctx, RD,
Kind).first->second;
163assert(Info &&
"info for comparison category not found");
175 caseCCKT::PartialOrdering:
176 return "partial_ordering";
177 caseCCKT::WeakOrdering:
178 return "weak_ordering";
179 caseCCKT::StrongOrdering:
180 return "strong_ordering";
182llvm_unreachable(
"unhandled cases in switch");
190 caseCCVT::Equivalent:
191 return "equivalent";
196 caseCCVT::Unordered:
199llvm_unreachable(
"unhandled case in switch");
202std::vector<ComparisonCategoryResult>
206std::vector<CCR> Values;
208 boolIsStrong =
Type== CCT::StrongOrdering;
209Values.push_back(IsStrong ? CCR::Equal : CCR::Equivalent);
210Values.push_back(CCR::Less);
211Values.push_back(CCR::Greater);
212 if(
Type== CCT::PartialOrdering)
213Values.push_back(CCR::Unordered);
Defines the clang::ASTContext interface.
static const NamespaceDecl * lookupStdNamespace(const ASTContext &Ctx, NamespaceDecl *&StdNS)
static const CXXRecordDecl * lookupCXXRecordDecl(const ASTContext &Ctx, const NamespaceDecl *StdNS, ComparisonCategoryType Kind)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
llvm::MachO::Record Record
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
Represents a C++ struct/union/class.
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
const ComparisonCategoryInfo * lookupInfoForType(QualType Ty) const
const ComparisonCategoryInfo & getInfoForType(QualType Ty) const
Return the comparison category information as specified by getCategoryForType(Ty).
const ComparisonCategoryInfo * lookupInfo(ComparisonCategoryType Kind) const
Return the cached comparison category information for the specified 'Kind'.
static StringRef getCategoryString(ComparisonCategoryType Kind)
static StringRef getResultString(ComparisonCategoryResult Kind)
static std::vector< ComparisonCategoryResult > getPossibleResultsForType(ComparisonCategoryType Type)
Return the list of results which are valid for the specified comparison category type.
const CXXRecordDecl * Record
The declaration for the comparison category type from the standard library.
ComparisonCategoryType Kind
The Kind of the comparison category type.
The results of name lookup within a DeclContext.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
ASTContext & getASTContext() const LLVM_READONLY
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Represent a C++ namespace.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isObjectPointerType() const
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool isRealFloatingType() const
Floating point categories.
bool isUsableInConstantExpressions(const ASTContext &C) const
Determine whether this variable's value can be used in a constant expression, according to the releva...
The JSON file list parser is used to communicate input to InstallAPI.
std::optional< ComparisonCategoryType > getComparisonCategoryForBuiltinCmp(QualType T)
Get the comparison category that should be used when comparing values of type T.
ComparisonCategoryResult
An enumeration representing the possible results of a three-way comparison.
ComparisonCategoryType
An enumeration representing the different comparison categories types.
const FunctionProtoType * T
bool hasValidIntValue() const
True iff we've successfully evaluated the variable as a constant expression and extracted its integer...
ComparisonCategoryResult Kind
llvm::APSInt getIntValue() const
Get the constant integer value used by this variable to represent the comparison category result type...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4