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);
92 bool WithGlobalNsPrefix) {
118 bool WithGlobalNsPrefix) {
122 assert(!isa<DependentTemplateSpecializationType>(TypePtr));
125 if (
const auto *TST = dyn_cast<const TemplateSpecializationType>(TypePtr)) {
126 bool MightHaveChanged =
false;
134 Ctx, Arg, WithGlobalNsPrefix);
135 FQArgs.push_back(Arg);
140 if (MightHaveChanged) {
142 TST->getTemplateName(), FQArgs,
143 TST->getCanonicalTypeInternal());
149 }
else if (
const auto *TSTRecord = dyn_cast<const RecordType>(TypePtr)) {
154 if (
const auto *TSTDecl =
155 dyn_cast<ClassTemplateSpecializationDecl>(TSTRecord->getDecl())) {
158 bool MightHaveChanged =
false;
160 for (
unsigned int I = 0, E = TemplateArgs.
size(); I != E; ++I) {
165 Ctx, Arg, WithGlobalNsPrefix);
166 FQArgs.push_back(Arg);
171 if (MightHaveChanged) {
175 TSTRecord->getCanonicalTypeInternal());
188 bool WithGlobalNsPrefix) {
190 if (
const auto *NS = dyn_cast<NamespaceDecl>(DC)) {
191 while (NS && NS->isInline()) {
195 if (NS->getDeclName()) {
199 }
else if (
const auto *TD = dyn_cast<TagDecl>(DC)) {
201 }
else if (
const auto *TDD = dyn_cast<TypedefNameDecl>(DC)) {
203 Ctx, TDD, FullyQualify, WithGlobalNsPrefix);
213 bool WithGlobalNsPrefix) {
235 Ctx, Scope->
getPrefix(), WithGlobalNsPrefix);
243 TD = TagDeclType->getDecl();
251 }
else if (
const auto *TDD = dyn_cast<TypedefType>(Type)) {
259 llvm_unreachable(
"bad NNS kind");
266 bool FullyQualified,
bool WithGlobalNsPrefix) {
270 const auto *Outer = dyn_cast_or_null<NamedDecl>(DC);
271 const auto *OuterNS = dyn_cast_or_null<NamespaceDecl>(DC);
272 if (Outer && !(OuterNS && OuterNS->isAnonymousNamespace())) {
273 if (
const auto *CxxDecl = dyn_cast<CXXRecordDecl>(DC)) {
275 CxxDecl->getDescribedClassTemplate()) {
286 if (ClassTempl->spec_begin() != ClassTempl->spec_end()) {
287 Decl = *(ClassTempl->spec_begin());
296 }
else if (
const auto *TD = dyn_cast<TagDecl>(Outer)) {
298 Ctx, TD, FullyQualified, WithGlobalNsPrefix);
299 }
else if (dyn_cast<TranslationUnitDecl>(Outer)) {
318 bool FullyQualified,
bool WithGlobalNsPrefix) {
319 if (!TypePtr)
return nullptr;
323 if (
const auto *TDT = dyn_cast<TypedefType>(TypePtr)) {
324 Decl = TDT->getDecl();
325 }
else if (
const auto *TagDeclType = dyn_cast<TagType>(TypePtr)) {
326 Decl = TagDeclType->getDecl();
327 }
else if (
const auto *TST = dyn_cast<TemplateSpecializationType>(TypePtr)) {
328 Decl = TST->getTemplateName().getAsTemplateDecl();
333 if (!Decl)
return nullptr;
336 Ctx, Decl, FullyQualified, WithGlobalNsPrefix);
341 bool WithGlobalNsPrefix) {
342 while (Namespace && Namespace->
isInline()) {
346 if (!Namespace)
return nullptr;
348 bool FullyQualified =
true;
351 createOuterNNS(Ctx, Namespace, FullyQualified, WithGlobalNsPrefix),
358 bool WithGlobalNsPrefix) {
369 bool WithGlobalNsPrefix) {
382 if (
auto *MPT = dyn_cast<MemberPointerType>(QT.
getTypePtr())) {
399 bool IsLValueRefTy = isa<LValueReferenceType>(QT.
getTypePtr());
417 while (isa<SubstTemplateTypeParmType>(QT.
getTypePtr())) {
421 QT = cast<SubstTemplateTypeParmType>(QT.
getTypePtr())->desugar();
434 if (
const auto *ETypeInput = dyn_cast<ElaboratedType>(QT.
getTypePtr())) {
435 QT = ETypeInput->getNamedType();
437 Keyword = ETypeInput->getKeyword();
446 if (isa<const TemplateSpecializationType>(QT.
getTypePtr()) ||
456 if (Prefix || Keyword !=
ETK_None) {
466 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.
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
A (possibly-)qualified type.
static bool getFullyQualifiedTemplateName(const ASTContext &Ctx, TemplateName &TName, bool WithGlobalNsPrefix)
static NestedNameSpecifier * createNestedNameSpecifier(const ASTContext &Ctx, const NamespaceDecl *Namesp, bool WithGlobalNsPrefix)
Create a NestedNameSpecifier for Namesp and its enclosing scopes.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
unsigned size() const
Retrieve the number of template arguments in this template argument list.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
const Type * getTypeForDecl() const
Decl - This represents one declaration (or definition), e.g.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
Defines the C++ template declaration subclasses.
The base class of the type hierarchy.
Represent a C++ namespace.
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.
const T * getAs() const
Member-template getAs<specific type>'.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
NamespaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this namespace.
A namespace, stored as a NamespaceDecl*.
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 ...
Describes how types, statements, expressions, and declarations should be printed. ...
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
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 ...
bool isInline() const
Returns true if this is an inline namespace declaration.
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
std::string getFullyQualifiedName(QualType QT, const ASTContext &Ctx, const PrintingPolicy &Policy, bool WithGlobalNsPrefix=false)
Get the fully qualified name for a type.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
Represents a declaration of a type.
Scope - A scope is a transient data structure that is used while parsing the program.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
static const Type * getFullyQualifiedTemplateType(const ASTContext &Ctx, const Type *TypePtr, bool WithGlobalNsPrefix)
DeclContext * getDeclContext()
Represents a C++ template name within the type system.
A namespace alias, stored as a NamespaceAliasDecl*.
A type, stored as a Type*.
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
Represents the declaration of a struct/union/class/enum.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
Represents a template argument.
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
Represents a template name that was expressed as a qualified name.
Dataflow Directional Tag Classes.
static NestedNameSpecifier * createOuterNNS(const ASTContext &Ctx, const Decl *D, bool FullyQualify, bool WithGlobalNsPrefix)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
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...
The base class of all kinds of template declarations (e.g., class, function, etc.).
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
A type that was preceded by the 'template' keyword, stored as a Type*.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
The template argument is a type.
static bool getFullyQualifiedTemplateArgument(const ASTContext &Ctx, TemplateArgument &Arg, bool WithGlobalNsPrefix)
A template argument list.
ArgKind getKind() const
Return the kind of stored template argument.
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
The template argument is a template name that was provided for a template template parameter...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Declaration of a class template.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getAsType() const
Retrieve the type for a type template argument.
static NestedNameSpecifier * getFullyQualifiedNestedNameSpecifier(const ASTContext &Ctx, NestedNameSpecifier *scope, bool WithGlobalNsPrefix)
Return a fully qualified version of this name specifier.
This represents a decl that may have a name.
bool isTranslationUnit() const
No keyword precedes the qualified type name.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
The global specifier '::'. There is no stored value.
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateDecl *Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.