34 bool WithGlobalNsPrefix);
45 const ASTContext &Ctx,
46 const NamespaceDecl *Namesp,
47 bool WithGlobalNsPrefix);
60 const ASTContext &Ctx,
const TypeDecl *TD,
61 bool FullyQualify,
bool WithGlobalNsPrefix);
64 const ASTContext &Ctx,
const Decl *
decl,
65 bool FullyQualified,
bool WithGlobalNsPrefix);
68 const ASTContext &Ctx, NestedNameSpecifier *scope,
bool WithGlobalNsPrefix);
72 bool WithGlobalNsPrefix) {
79 assert(ArgTDecl !=
nullptr);
85 Ctx, NNS, WithGlobalNsPrefix);
94 Ctx, ArgTDecl,
true, WithGlobalNsPrefix);
106 bool WithGlobalNsPrefix) {
107 bool Changed =
false;
132 bool WithGlobalNsPrefix) {
136 assert(!isa<DependentTemplateSpecializationType>(TypePtr));
139 if (
const auto *TST = dyn_cast<const TemplateSpecializationType>(TypePtr)) {
140 bool MightHaveChanged =
false;
148 Ctx, Arg, WithGlobalNsPrefix);
149 FQArgs.push_back(Arg);
154 if (MightHaveChanged) {
156 TST->getTemplateName(), FQArgs,
157 TST->getCanonicalTypeInternal());
163 }
else if (
const auto *TSTRecord = dyn_cast<const RecordType>(TypePtr)) {
168 if (
const auto *TSTDecl =
169 dyn_cast<ClassTemplateSpecializationDecl>(TSTRecord->getDecl())) {
172 bool MightHaveChanged =
false;
174 for (
unsigned int I = 0,
E = TemplateArgs.
size();
I !=
E; ++
I) {
179 Ctx, Arg, WithGlobalNsPrefix);
180 FQArgs.push_back(Arg);
185 if (MightHaveChanged) {
189 TSTRecord->getCanonicalTypeInternal());
202 bool WithGlobalNsPrefix) {
204 if (
const auto *NS = dyn_cast<NamespaceDecl>(DC)) {
205 while (NS && NS->isInline()) {
209 if (NS->getDeclName()) {
213 }
else if (
const auto *TD = dyn_cast<TagDecl>(DC)) {
215 }
else if (
const auto *TDD = dyn_cast<TypedefNameDecl>(DC)) {
217 Ctx, TDD, FullyQualify, WithGlobalNsPrefix);
227 bool WithGlobalNsPrefix) {
249 Ctx, Scope->
getPrefix(), WithGlobalNsPrefix);
257 TD = TagDeclType->getDecl();
265 }
else if (
const auto *TDD = dyn_cast<TypedefType>(Type)) {
273 llvm_unreachable(
"bad NNS kind");
280 bool FullyQualified,
bool WithGlobalNsPrefix) {
284 const auto *Outer = dyn_cast_or_null<NamedDecl>(DC);
285 const auto *OuterNS = dyn_cast_or_null<NamespaceDecl>(DC);
286 if (Outer && !(OuterNS && OuterNS->isAnonymousNamespace())) {
287 if (
const auto *CxxDecl = dyn_cast<CXXRecordDecl>(DC)) {
289 CxxDecl->getDescribedClassTemplate()) {
300 if (ClassTempl->spec_begin() != ClassTempl->spec_end()) {
301 Decl = *(ClassTempl->spec_begin());
310 }
else if (
const auto *TD = dyn_cast<TagDecl>(Outer)) {
312 Ctx, TD, FullyQualified, WithGlobalNsPrefix);
313 }
else if (dyn_cast<TranslationUnitDecl>(Outer)) {
332 bool FullyQualified,
bool WithGlobalNsPrefix) {
333 if (!TypePtr)
return nullptr;
337 if (
const auto *TDT = dyn_cast<TypedefType>(TypePtr)) {
338 Decl = TDT->getDecl();
339 }
else if (
const auto *TagDeclType = dyn_cast<TagType>(TypePtr)) {
340 Decl = TagDeclType->getDecl();
341 }
else if (
const auto *TST = dyn_cast<TemplateSpecializationType>(TypePtr)) {
342 Decl = TST->getTemplateName().getAsTemplateDecl();
347 if (!Decl)
return nullptr;
350 Ctx, Decl, FullyQualified, WithGlobalNsPrefix);
355 bool WithGlobalNsPrefix) {
356 while (Namespace && Namespace->
isInline()) {
360 if (!Namespace)
return nullptr;
362 bool FullyQualified =
true;
365 createOuterNNS(Ctx, Namespace, FullyQualified, WithGlobalNsPrefix),
372 bool WithGlobalNsPrefix) {
383 bool WithGlobalNsPrefix) {
400 bool IsLValueRefTy = isa<LValueReferenceType>(QT.
getTypePtr());
418 while (isa<SubstTemplateTypeParmType>(QT.
getTypePtr())) {
435 if (
const auto *ETypeInput = dyn_cast<ElaboratedType>(QT.
getTypePtr())) {
436 QT = ETypeInput->getNamedType();
438 Keyword = ETypeInput->getKeyword();
447 if (isa<const TemplateSpecializationType>(QT.
getTypePtr()) ||
457 if (Prefix || Keyword !=
ETK_None) {
466 bool WithGlobalNsPrefix) {
469 Policy.AnonymousTagLocations =
false;
470 Policy.PolishForDeclaration =
true;
471 Policy.SuppressUnwrittenScope =
true;
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType) const
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
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.
A (possibly-)qualified type.
static bool getFullyQualifiedTemplateName(const ASTContext &Ctx, TemplateName &TName, bool WithGlobalNsPrefix)
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
static NestedNameSpecifier * createNestedNameSpecifier(const ASTContext &Ctx, const NamespaceDecl *Namesp, bool WithGlobalNsPrefix)
Create a NestedNameSpecifier for Namesp and its enclosing scopes.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
Decl - This represents one declaration (or definition), e.g.
Defines the C++ template declaration subclasses.
std::string getAsString() const
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
The base class of the type hierarchy.
NamespaceDecl - Represent a C++ namespace.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
An identifier, stored as an IdentifierInfo*.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
NamespaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this namespace.
A namespace, stored as a NamespaceDecl*.
Describes how types, statements, expressions, and declarations should be printed. ...
Represents the result of substituting a type for a template type parameter.
The collection of all-type qualifiers we support.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
bool isTranslationUnit() const
unsigned size() const
Retrieve the number of template arguments in this template argument list.
static QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx, bool WithGlobalNsPrefix)
Generates a QualType that can be used to name the same type if used at the end of the current transla...
bool isInline() const
Returns true if this is an inline namespace declaration.
TypeDecl - Represents a declaration of a type.
bool SuppressScope
Suppresses printing of scope specifiers.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
Scope - A scope is a transient data structure that is used while parsing the program.
detail::InMemoryDirectory::const_iterator I
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
const Type * getTypeForDecl() const
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
static const Type * getFullyQualifiedTemplateType(const ASTContext &Ctx, const Type *TypePtr, bool WithGlobalNsPrefix)
ArgKind getKind() const
Return the kind of stored template argument.
DeclContext * getDeclContext()
Represents a C++ template name within the type system.
A namespace alias, stored as a NamespaceAliasDecl*.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
A type, stored as a Type*.
const clang::PrintingPolicy & getPrintingPolicy() const
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateDecl *Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
TagDecl - Represents the declaration of a struct/union/class/enum.
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
Represents a template argument.
QualType getAsType() const
Retrieve the type for a type template argument.
Represents a template name that was expressed as a qualified name.
static NestedNameSpecifier * createOuterNNS(const ASTContext &Ctx, const Decl *D, bool FullyQualify, bool WithGlobalNsPrefix)
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
The base class of all kinds of template declarations (e.g., class, function, etc.).
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
detail::InMemoryDirectory::const_iterator E
A type that was preceded by the 'template' keyword, stored as a Type*.
const T * getAs() const
Member-template getAs<specific type>'.
std::string getFullyQualifiedName(QualType QT, const ASTContext &Ctx, bool WithGlobalNsPrefix=false)
Get the fully qualified name for a type.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
The template argument is a type.
static bool getFullyQualifiedTemplateArgument(const ASTContext &Ctx, TemplateArgument &Arg, bool WithGlobalNsPrefix)
A template argument list.
The template argument is a template name that was provided for a template template parameter...
Declaration of a class template.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
static NestedNameSpecifier * getFullyQualifiedNestedNameSpecifier(const ASTContext &Ctx, NestedNameSpecifier *scope, bool WithGlobalNsPrefix)
Return a fully qualified version of this name specifier.
NamedDecl - This represents a decl with a name.
No keyword precedes the qualified type name.
The global specifier '::'. There is no stored value.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.