31 const ASTContext &Ctx,
32 const NamespaceDecl *Namesp,
33 bool WithGlobalNsPrefix);
46 const ASTContext &Ctx,
const TypeDecl *TD,
47 bool FullyQualify,
bool WithGlobalNsPrefix);
50 const ASTContext &Ctx,
const Decl *
decl,
51 bool FullyQualified,
bool WithGlobalNsPrefix);
54 const ASTContext &Ctx, NestedNameSpecifier *scope,
bool WithGlobalNsPrefix);
58 bool WithGlobalNsPrefix) {
65 assert(ArgTDecl !=
nullptr);
71 Ctx, NNS, WithGlobalNsPrefix);
80 Ctx, ArgTDecl,
true, WithGlobalNsPrefix);
96 bool WithGlobalNsPrefix) {
122 bool WithGlobalNsPrefix) {
126 assert(!isa<DependentTemplateSpecializationType>(TypePtr));
129 if (
const auto *TST = dyn_cast<const TemplateSpecializationType>(TypePtr)) {
130 bool MightHaveChanged =
false;
136 Ctx, Arg, WithGlobalNsPrefix);
137 FQArgs.push_back(Arg);
142 if (MightHaveChanged) {
144 TST->getTemplateName(), FQArgs,
145 TST->getCanonicalTypeInternal());
151 }
else if (
const auto *TSTRecord = dyn_cast<const RecordType>(TypePtr)) {
156 if (
const auto *TSTDecl =
157 dyn_cast<ClassTemplateSpecializationDecl>(TSTRecord->getDecl())) {
160 bool MightHaveChanged =
false;
162 for (
unsigned int I = 0, E = TemplateArgs.
size(); I != E; ++I) {
167 Ctx, Arg, WithGlobalNsPrefix);
168 FQArgs.push_back(Arg);
173 if (MightHaveChanged) {
177 TSTRecord->getCanonicalTypeInternal());
190 bool WithGlobalNsPrefix) {
192 if (
const auto *NS = dyn_cast<NamespaceDecl>(DC)) {
193 while (NS && NS->isInline()) {
195 NS = dyn_cast<NamespaceDecl>(NS->getDeclContext());
197 if (NS && NS->getDeclName()) {
201 }
else if (
const auto *TD = dyn_cast<TagDecl>(DC)) {
203 }
else if (
const auto *TDD = dyn_cast<TypedefNameDecl>(DC)) {
205 Ctx, TDD, FullyQualify, WithGlobalNsPrefix);
215 bool WithGlobalNsPrefix) {
216 switch (
Scope->getKind()) {
222 Ctx,
Scope->getAsNamespace(), WithGlobalNsPrefix);
230 Scope->getAsNamespaceAlias()->getNamespace()->getCanonicalDecl(),
237 Ctx,
Scope->getPrefix(), WithGlobalNsPrefix);
245 TD = TagDeclType->getDecl();
253 }
else if (
const auto *TDD = dyn_cast<TypedefType>(
Type)) {
261 llvm_unreachable(
"bad NNS kind");
268 bool FullyQualified,
bool WithGlobalNsPrefix) {
272 const auto *Outer = dyn_cast_or_null<NamedDecl>(DC);
273 const auto *OuterNS = dyn_cast_or_null<NamespaceDecl>(DC);
274 if (Outer && !(OuterNS && OuterNS->isAnonymousNamespace())) {
275 if (
const auto *CxxDecl = dyn_cast<CXXRecordDecl>(DC)) {
277 CxxDecl->getDescribedClassTemplate()) {
288 if (ClassTempl->spec_begin() != ClassTempl->spec_end()) {
289 Decl = *(ClassTempl->spec_begin());
290 Outer = dyn_cast<NamedDecl>(
Decl);
291 OuterNS = dyn_cast<NamespaceDecl>(
Decl);
298 }
else if (
const auto *TD = dyn_cast<TagDecl>(Outer)) {
300 Ctx, TD, FullyQualified, WithGlobalNsPrefix);
301 }
else if (isa<TranslationUnitDecl>(Outer)) {
320 bool FullyQualified,
bool WithGlobalNsPrefix) {
321 if (!TypePtr)
return nullptr;
325 if (
const auto *TDT = dyn_cast<TypedefType>(TypePtr)) {
326 Decl = TDT->getDecl();
327 }
else if (
const auto *TagDeclType = dyn_cast<TagType>(TypePtr)) {
328 Decl = TagDeclType->getDecl();
329 }
else if (
const auto *TST = dyn_cast<TemplateSpecializationType>(TypePtr)) {
330 Decl = TST->getTemplateName().getAsTemplateDecl();
335 if (!
Decl)
return nullptr;
338 Ctx,
Decl, FullyQualified, WithGlobalNsPrefix);
343 bool WithGlobalNsPrefix) {
344 while (Namespace && Namespace->isInline()) {
346 Namespace = dyn_cast<NamespaceDecl>(Namespace->getDeclContext());
348 if (!Namespace)
return nullptr;
350 bool FullyQualified =
true;
353 createOuterNNS(Ctx, Namespace, FullyQualified, WithGlobalNsPrefix),
360 bool WithGlobalNsPrefix) {
362 if (isa<const TemplateSpecializationType>(TypePtr) ||
363 isa<const RecordType>(TypePtr)) {
379 bool WithGlobalNsPrefix) {
392 if (
auto *MPT = dyn_cast<MemberPointerType>(QT.
getTypePtr())) {
409 bool IsLValueRefTy = isa<LValueReferenceType>(QT.
getTypePtr());
427 while (isa<SubstTemplateTypeParmType>(QT.
getTypePtr())) {
431 QT = cast<SubstTemplateTypeParmType>(QT.
getTypePtr())->desugar();
444 if (
const auto *ETypeInput = dyn_cast<ElaboratedType>(QT.
getTypePtr())) {
445 QT = ETypeInput->getNamedType();
447 Keyword = ETypeInput->getKeyword();
464 if (isa<const TemplateSpecializationType>(QT.
getTypePtr()) ||
484 bool WithGlobalNsPrefix) {
Defines the C++ template declaration subclasses.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
Declaration of a class template.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isTranslationUnit() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
Decl - This represents one declaration (or definition), e.g.
DeclContext * getDeclContext()
Represent a C++ namespace.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.
@ 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*.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
A (possibly-)qualified type.
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name that was expressed as a qualified name.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
The collection of all-type qualifiers we support.
Scope - A scope is a transient data structure that is used while parsing the program.
Represents the declaration of a struct/union/class/enum.
A template argument list.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Represents a template argument.
QualType getAsType() const
Retrieve the type for a type template argument.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
@ Template
The template argument is a template name that was provided for a template template parameter.
@ Type
The template argument is a type.
ArgKind getKind() const
Return the kind of stored template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
UsingShadowDecl * getAsUsingShadowDecl() const
Retrieve the using shadow declaration through which the underlying template declaration is introduced...
Represents a declaration of a type.
const Type * getTypeForDecl() const
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...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
const T * getAs() const
Member-template getAs<specific type>'.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
static NestedNameSpecifier * createOuterNNS(const ASTContext &Ctx, const Decl *D, bool FullyQualify, bool WithGlobalNsPrefix)
static bool getFullyQualifiedTemplateName(const ASTContext &Ctx, TemplateName &TName, bool WithGlobalNsPrefix)
static const Type * getFullyQualifiedTemplateType(const ASTContext &Ctx, const Type *TypePtr, bool WithGlobalNsPrefix)
static NestedNameSpecifier * getFullyQualifiedNestedNameSpecifier(const ASTContext &Ctx, NestedNameSpecifier *scope, bool WithGlobalNsPrefix)
Return a fully qualified version of this name specifier.
static bool getFullyQualifiedTemplateArgument(const ASTContext &Ctx, TemplateArgument &Arg, bool WithGlobalNsPrefix)
static NestedNameSpecifier * createNestedNameSpecifierForScopeOf(const ASTContext &Ctx, const Decl *decl, bool FullyQualified, bool WithGlobalNsPrefix)
Create a nested name specifier for the declaring context of the type.
std::string getFullyQualifiedName(QualType QT, const ASTContext &Ctx, const PrintingPolicy &Policy, bool WithGlobalNsPrefix=false)
Get the fully qualified name for a type.
static NestedNameSpecifier * createNestedNameSpecifier(const ASTContext &Ctx, const NamespaceDecl *Namesp, bool WithGlobalNsPrefix)
Create a NestedNameSpecifier for Namesp and its enclosing scopes.
QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx, bool WithGlobalNsPrefix=false)
Generates a QualType that can be used to name the same type if used at the end of the current transla...
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
Describes how types, statements, expressions, and declarations should be printed.