TL = AttrTL.getModifiedLoc();
67DeclarationFragments::appendUnduplicatedTextCharacter(
charCharacter) {
68 if(!Fragments.empty()) {
69Fragment &
Last= Fragments.back();
73 if(
Last.Spelling.back() != Character) {
74 Last.Spelling.push_back(Character);
78Fragments.back().Spelling.push_back(Character);
86 returnappendUnduplicatedTextCharacter(
' ');
90 returnappendUnduplicatedTextCharacter(
';');
94 if(Fragments.empty())
99 Last.Spelling.pop_back();
118 return "identifier";
120 return "typeIdentifier";
122 return "genericParameter";
124 return "externalParam";
126 return "internalParam";
131llvm_unreachable(
"Unhandled FragmentKind");
136 returnllvm::StringSwitch<FragmentKind>(S)
142.Case(
"typeIdentifier",
144.Case(
"genericParameter",
155 switch(ExceptionSpec) {
188llvm_unreachable(
"Unhandled exception specification");
196 else if(
Record->isUnion())
214Fragments.
append(getFragmentsForNNS(NNS->
getPrefix(), Context, After));
237Fragments.
append(Alias->getName(),
262Fragments.
append(getFragmentsForType(
T, Context, After));
275assert(
T&&
"invalid type");
281getFragmentsForType(MQT->getUnderlyingType(), Context, After));
288getFragmentsForType(AT->getModifiedType(), Context, After));
305Fragments.
append(getFragmentsForNNS(NNS, Context, After));
309 returnFragments.
append(getFragmentsForType(ET->desugar(), Context, After));
317 if(
const TypedefType*TypedefTy = dyn_cast<TypedefType>(
T)) {
320std::string USR = TypedefResolver.getUSRForType(
QualType(
T, 0));
327 returnFragments.
append(
329USR, TypedefResolver.getUnderlyingTypeDecl(
QualType(
T, 0)));
360getFragmentsForType(LRT->getPointeeTypeAsWritten(), Context, After))
368getFragmentsForType(RRT->getPointeeTypeAsWritten(), Context, After))
381 switch(AT->getSizeModifier()) {
398CAT->getSize().toStringUnsigned(Size);
404 returnFragments.
append(
405getFragmentsForType(AT->getElementType(), Context, After));
409dyn_cast<TemplateSpecializationType>(
T)) {
410 const autoTemplName = TemplSpecTy->getTemplateName();
412raw_string_ostream Stream(Str);
413TemplName.print(Stream, Context.getPrintingPolicy(),
416 if(
const auto*TemplDecl = TemplName.getAsTemplateDecl())
423TemplSpecTy->template_arguments(), Context, std::nullopt))
433 if(
const TagType*TagTy = dyn_cast<TagType>(
Base)) {
436 if(
Decl->getName().empty())
437 returnFragments.
append(
"{ ... }",
448 if(
const auto*ObjCIT = dyn_cast<ObjCInterfaceType>(
Base)) {
449 const auto*
Decl= ObjCIT->getDecl();
467DeclarationFragmentsBuilder::getFragmentsForQualifiers(
const QualifiersQuals) {
481assert(!QT.
isNull() &&
"invalid type");
483 if(
const ParenType*PT = dyn_cast<ParenType>(QT)) {
485 returngetFragmentsForType(PT->getInnerType(), Context, After)
492getFragmentsForType(SQT.
Ty, Context, After);
494TypeFragments.replace(
"bool", 0);
497 returnTypeFragments;
517 returnTypeFragments.appendSpace().append(std::move(QualsFragments));
526 if(!
Decl->isAnonymousNamespace())
565Fragments.
append(getFragmentsForBlock(Var, BlockLoc, BlockProtoLoc, After));
570.
append(std::move(After))
593 if(StringRef(ArgumentFragment.
begin()->Spelling)
594.starts_with(
"type-parameter")) {
595std::string ProperArgName =
T.getAsString();
596ArgumentFragment.
begin()->Spelling.swap(ProperArgName);
598Fragments.
append(std::move(ArgumentFragment))
606DeclarationFragmentsBuilder::getFragmentsForParam(
const ParmVarDecl*Param) {
617findTypeLocForBlockDecl(TSInfo, BlockLoc, BlockProtoLoc);
622getFragmentsForBlock(Param, BlockLoc, BlockProtoLoc, After));
626 if(StringRef(TypeFragments.
begin()->Spelling)
627.starts_with(
"type-parameter")) {
629TypeFragments.
begin()->Spelling.swap(ProperArgName);
634.
append(std::move(TypeFragments))
635.
append(std::move(After))
640Fragments.
append(std::move(TypeFragments));
646.
append(std::move(After));
657 autoReturnValueFragment = getFragmentsForType(
660Fragments.
append(std::move(ReturnValueFragment))
661.
append(std::move(RetTyAfter))
666 unsignedNumParams =
Block.getNumParams();
668 if(!BlockProto || NumParams == 0) {
675 for(
unsignedI = 0; I != NumParams; ++I) {
678 After.append(getFragmentsForParam(
Block.getParam(I)));
691 switch(
Func->getStorageClass()) {
705llvm_unreachable(
"invalid for functions");
707 if(
Func->isConsteval())
710 else if(
Func->isConstexpr())
716 autoReturnValueFragment =
717getFragmentsForType(
Func->getReturnType(),
Func->getASTContext(), After);
718 if(StringRef(ReturnValueFragment.begin()->Spelling)
719.starts_with(
"type-parameter")) {
720std::string ProperArgName =
Func->getReturnType().getAsString();
721ReturnValueFragment.begin()->Spelling.swap(ProperArgName);
724Fragments.
append(std::move(ReturnValueFragment))
729 if(
Func->getTemplateSpecializationInfo()) {
732 for(
unsignedi = 0, end =
Func->getNumParams(); i != end; ++i) {
736getFragmentsForType(
Func->getParamDecl(i)->getType(),
737 Func->getParamDecl(i)->getASTContext(), After));
741Fragments.
append(std::move(After));
744 unsignedNumParams =
Func->getNumParams();
745 for(
unsignedi = 0; i != NumParams; ++i) {
748Fragments.
append(getFragmentsForParam(
Func->getParamDecl(i)));
751 if(
Func->isVariadic()) {
759 Func->getExceptionSpecType()));
784 if(!IntegerType.
isNull())
789.
append(std::move(After));
802 if(Field->isMutable())
807getFragmentsForType(Field->getType(), Field->getASTContext(), After))
810.
append(std::move(After))
826 if(!
Record->getName().empty())
843 if(!
Record->getName().empty())
855 if(
const auto*Constructor = dyn_cast<CXXConstructorDecl>(Method)) {
857 if(Constructor->isExplicit())
860}
else if(isa<CXXDestructorDecl>(Method))
865.
append(std::move(After));
867 for(
unsignedi = 0, end = Method->
getNumParams(); i != end; ++i) {
883StringRef Name = Method->
getName();
901.
append(std::move(After));
903 for(
unsignedi = 0, end = Method->
getNumParams(); i != end; ++i) {
925 if(ConversionFunction->isExplicit())
933.
append(ConversionFunction->getConversionType().getAsString(),
936 for(
unsignedi = 0, end = ConversionFunction->getNumParams(); i != end;
940Fragments.
append(getFragmentsForParam(ConversionFunction->getParamDecl(i)));
944 if(ConversionFunction->isConst())
964.
append(std::move(After));
966 for(
unsignedi = 0, end = Method->
getNumParams(); i != end; ++i) {
988 for(
unsignedi = 0, end = ParameterArray.size(); i != end; ++i) {
994dyn_cast<TemplateTypeParmDecl>(ParameterArray[i])) {
1002Fragments.
append(
"typename",
1022}
else if(
const auto*NTP =
1023dyn_cast<NonTypeTemplateParmDecl>(ParameterArray[i])) {
1025 const autoTyFragments =
1026getFragmentsForType(NTP->getType(), NTP->getASTContext(), After);
1027Fragments.
append(std::move(TyFragments)).
append(std::move(After));
1029 if(NTP->isParameterPack())
1032 if(!NTP->getName().empty())
1037 if(NTP->hasDefaultArgument()) {
1039raw_svector_ostream Output(ExprStr);
1040NTP->getDefaultArgument().getArgument().print(
1041NTP->getASTContext().getPrintingPolicy(), Output,
1046}
else if(
const auto*TTP =
1047dyn_cast<TemplateTemplateParmDecl>(ParameterArray[i])) {
1052TTP->getTemplateParameters()->asArray()))
1055.
append(TTP->wasDeclaredWithTypename() ?
"typename":
"class",
1058 if(TTP->isParameterPack())
1061 if(!TTP->getName().empty())
1065 if(TTP->hasDefaultArgument()) {
1066 const auto Default= TTP->getDefaultArgument();
1087 for(
unsignedi = 0, end = TemplateArguments.size(); i != end; ++i) {
1092 const auto&CTA = TemplateArguments[i];
1093 switch(CTA.getKind()) {
1097getFragmentsForType(CTA.getAsType(), Context, After);
1099 if(StringRef(ArgumentFragment.
begin()->Spelling)
1100.starts_with(
"type-parameter")) {
1101 if(TemplateArgumentLocs.has_value() &&
1102TemplateArgumentLocs->size() > i) {
1103std::string ProperArgName = TemplateArgumentLocs.value()[i]
1104.getTypeSourceInfo()
1107ArgumentFragment.
begin()->Spelling.swap(ProperArgName);
1109 auto&Spelling = ArgumentFragment.
begin()->Spelling;
1111raw_string_ostream OutStream(Spelling);
1112CTA.print(Context.getPrintingPolicy(), OutStream,
false);
1116Fragments.
append(std::move(ArgumentFragment));
1120 const auto*VD = CTA.getAsDecl();
1123Fragments.
append(VD->getNameAsString(),
1133CTA.getAsIntegral().toString(Str);
1139 const autoSVTy = CTA.getStructuralValueType();
1140Fragments.
append(CTA.getAsStructuralValue().getAsString(Context, SVTy),
1148raw_string_ostream Stream(Str);
1149CTA.getAsTemplate().print(Stream, Context.getPrintingPolicy());
1151 if(
const auto*TemplDecl =
1152CTA.getAsTemplateOrTemplatePattern().getAsTemplateDecl())
1170raw_svector_ostream Output(ExprStr);
1171CTA.getAsExpr()->printPretty(Output,
nullptr,
1172Context.getPrintingPolicy());
1192Concept->getTemplateParameters()->asArray()))
1197.
append(Concept->getName().str(),
1214 if(isa<TypeAliasTemplateDecl>(RedeclarableTemplate))
1235cast<CXXRecordDecl>(
Decl)))
1240 Decl->getTemplateArgsAsWritten()->arguments()))
1254 Decl->getTemplateParameters()->asArray()))
1258cast<CXXRecordDecl>(
Decl)))
1263 Decl->getTemplateArgsAsWritten()->arguments()))
1283 Decl->getTemplateArgsAsWritten()->arguments()))
1298 Decl->getTemplateParameters()->asArray()))
1306 Decl->getTemplateArgsAsWritten()->arguments()))
1321 Decl->getTemplateParameters()->asArray()))
1353 for(
unsignedi = 0; i < numParameters; ++i) {
1404.
append(SuperClass->getName(),
1425.
append(std::move(After))
1438 for(
unsignedi = 0, end = Method->
param_size(); i != end; ++i) {
1444ParamID.append(
":");
1450Fragments.
append(getFragmentsForParam(Param));
1463 const autoAttributes =
Property->getPropertyAttributesAsWritten();
1470 autoRenderAttribute =
1472StringRef Arg =
"",
1476 if((Attributes & Kind) && !Spelling.empty()) {
1481Fragments.
append(Spelling,
1504 "unsafe_unretained");
1508 Property->getGetterName().getAsString());
1510 Property->getSetterName().getAsString());
1515 if(
const autoNullability =
1521Fragments.
append(
"null_resettable",
1538findTypeLocForBlockDecl(
Property->getTypeSourceInfo(), BlockLoc,
1541 autoPropType =
Property->getType();
1544.
append(getFragmentsForType(PropType,
Property->getASTContext(), After))
1548getFragmentsForBlock(
Property, BlockLoc, BlockProtoLoc, After));
1553.
append(std::move(After))
1563.
append(Protocol->getName(),
1567 if(!Protocol->protocols().empty()) {
1570It != Protocol->protocol_end(); It++) {
1572 if(It != Protocol->protocol_begin())
1577Fragments.
append((*It)->getName(),
1592.
append(getFragmentsForType(
Decl->getUnderlyingType(),
1594.
append(std::move(After))
1613 if(isa<CXXConstructorDecl>(
Decl) || isa<CXXDestructorDecl>(
Decl))
1616 else if(isa<CXXConversionDecl>(
Decl)) {
1620}
else if(isa<CXXMethodDecl>(
Decl) &&
1621cast<CXXMethodDecl>(
Decl)->isOverloadedOperator()) {
1622Fragments.
append(
Decl->getNameAsString(),
1624}
else if(isa<TagDecl>(
Decl) &&
1625cast<TagDecl>(
Decl)->getTypedefNameForAnonDecl()) {
1627}
else if(
Decl->getIdentifier()) {
1631Fragments.
append(
Decl->getDeclName().getAsString(),
Forward declaration of all AST node types.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines the Declaration Fragments related classes.
llvm::MachO::Record Record
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
This file defines the UnderlyingTypeResolver which is a helper type for resolving the undelrying type...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getUnqualifiedObjCPointerType(QualType type) const
getUnqualifiedObjCPointerType - Returns version of Objective-C pointer type with lifetime qualifier r...
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Type source information for an attributed type.
An attributed type is a type to which a type attribute has been applied.
static std::optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Wrapper for source info for block pointers.
Represents a C++ conversion function within a class.
Represents a static or instance method of a struct/union/class.
Represents a C++ struct/union/class.
Represents a class template specialization, which refers to a class template with a given set of temp...
Declaration of a C++20 concept.
Represents the canonical version of C arrays with a specified constant size.
Decl - This represents one declaration (or definition), e.g.
ASTContext & getASTContext() const LLVM_READONLY
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
DeclContext * getDeclContext()
TypeSourceInfo * getTypeSourceInfo() const
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
An instance of this object exists for each enum constant that is defined.
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Represents a member of a struct/union/class.
Represents a function declaration or definition.
const ParmVarDecl * getParamDecl(unsigned i) const
ExceptionSpecificationType getExceptionSpecType() const
Gets the ExceptionSpecificationType as declared.
QualType getReturnType() const
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
bool isVariadic() const
Whether this function prototype is variadic.
Declaration of a template function.
Wrapper for source info for functions.
StringRef getName() const
Return the actual identifier string.
const TypeClass * getTypePtr() const
An lvalue reference type, per C++11 [dcl.ref].
Encapsulates the data about a macro definition (e.g.
bool isC99Varargs() const
bool isFunctionLike() const
ArrayRef< const IdentifierInfo * > params() const
unsigned getNumParams() const
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
This represents a decl that may have a name.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
Represents a C++ namespace alias.
Represent a C++ namespace.
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
ObjCCategoryDecl - Represents a category declaration.
Represents an ObjC class declaration.
ObjCMethodDecl - Represents an instance or class method declaration.
unsigned param_size() const
Selector getSelector() const
bool isInstanceMethod() const
ParmVarDecl * getParamDecl(unsigned Idx)
QualType getReturnType() const
bool isClassMethod() const
Represents a pointer to an Objective C object.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
bool isObjCIdOrClassType() const
True if this is equivalent to the 'id' or 'Class' type,.
Represents one property declaration in an Objective-C interface.
Represents an Objective-C protocol declaration.
ObjCProtocolList::iterator protocol_iterator
Sugar for parentheses used when specifying types.
Represents a parameter to a function.
bool isObjCMethodParameter() const
QualType getOriginalType() const
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
Wrapper of type source information for a type with non-trivial direct qualifiers.
The collection of all-type qualifiers we support.
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
Declaration of a redeclarable template.
Smart pointer class that efficiently represents Objective-C method names.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
unsigned getNumArgs() const
Represents the declaration of a struct/union/class/enum.
TypedefNameDecl * getTypedefNameForAnonDecl() const
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
ArrayRef< NamedDecl * > asArray()
Represents a type template specialization; the template must be a class template, a type alias templa...
Base wrapper for a particular "section" of type source info.
UnqualTypeLoc getUnqualifiedLoc() const
Skips past any qualifiers, if this is qualified.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
TypeLoc IgnoreParens() const
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
static StringRef getKeywordName(ElaboratedTypeKeyword Keyword)
The base class of the type hierarchy.
bool isBlockPointerType() const
bool isFunctionPointerType() const
bool isPointerType() const
CanQualType getCanonicalTypeUnqualified() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isObjCIdType() const
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
bool isObjCObjectPointerType() const
bool isAnyPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Represents a variable declaration or definition.
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
static const char * getStorageClassSpecifierString(StorageClass SC)
Return the string used to specify the storage class SC.
bool isStaticDataMember() const
Determines whether this is a static data member.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Represents a variable template specialization, which refers to a variable template with a given set o...
@ kind_nullability
Indicates that the nullability of the type was spelled with a property attribute rather than a type q...
@ After
Like System, but searched after the system directories.
bool generateUSRForType(QualType T, ASTContext &Ctx, SmallVectorImpl< char > &Buf)
Generates a USR for a type.
bool generateUSRForDecl(const Decl *D, SmallVectorImpl< char > &Buf)
Generate a USR for a Decl, including the USR prefix.
@ Unspecified
Whether values of this type can be null is (explicitly) unspecified.
StorageClass
Storage classes.
@ Property
The type of a property.
llvm::StringRef getNullabilitySpelling(NullabilityKind kind, bool isContextSensitive=false)
Retrieve the spelling of the given nullability kind.
const FunctionProtoType * T
llvm::StringRef getAsString(SyncScope S)
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
@ None
No keyword precedes the qualified type name.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_DynamicNone
throw()
@ EST_None
no exception specification
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
@ EST_Dynamic
throw(T1, T2)
Diagnostic wrappers for TextAPI types for error reporting.
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
const Type * Ty
The locally-unqualified type.
Qualifiers Quals
The local qualifiers.
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