28static NestedNameSpecifier
30 bool WithGlobalNsPrefix);
45 bool WithGlobalNsPrefix);
47static NestedNameSpecifier
50 bool WithGlobalNsPrefix);
53 const ASTContext &Ctx, NestedNameSpecifier NNS,
bool WithGlobalNsPrefix);
57 bool WithGlobalNsPrefix) {
80 Ctx, ArgTDecl,
true, WithGlobalNsPrefix);
96 bool WithGlobalNsPrefix) {
121 const TagType *TSTRecord,
124 bool WithGlobalNsPrefix) {
129 const auto *TD = TSTRecord->getDecl();
130 const auto *TSTDecl = dyn_cast<ClassTemplateSpecializationDecl>(TD);
137 bool MightHaveChanged =
false;
139 for (
unsigned int I = 0, E = TemplateArgs.
size(); I != E; ++I) {
145 FQArgs.push_back(Arg);
148 if (!MightHaveChanged)
158 {}, TSTRecord->getCanonicalTypeInternal());
167 const TemplateSpecializationType *TST,
168 bool WithGlobalNsPrefix) {
170 bool MightHaveChanged =
178 FQArgs.push_back(Arg);
181 if (!MightHaveChanged)
195 bool WithGlobalNsPrefix) {
197 if (
const auto *NS = dyn_cast<NamespaceDecl>(DC)) {
198 while (NS && NS->isInline()) {
200 NS = dyn_cast<NamespaceDecl>(NS->getDeclContext());
202 if (NS && NS->getDeclName()) {
207 if (
const auto *TD = dyn_cast<TagDecl>(DC))
209 if (
const auto *TDD = dyn_cast<TypedefNameDecl>(DC))
220 switch (
Scope.getKind()) {
222 llvm_unreachable(
"can't fully qualify the empty nested name specifier");
229 Ctx,
Scope.getAsNamespaceAndPrefix().Namespace->getNamespace(),
235 if (
const TagType *TagDeclType =
Type->
getAs<TagType>())
236 TD = TagDeclType->getDecl();
237 else if (
const auto *D = dyn_cast<TypedefType>(
Type))
245 llvm_unreachable(
"bad NNS kind");
253 bool WithGlobalNsPrefix) {
260 const auto *Outer = dyn_cast<NamedDecl>(DC);
261 const auto *OuterNS = dyn_cast<NamespaceDecl>(DC);
262 if (OuterNS && OuterNS->isAnonymousNamespace())
263 OuterNS = dyn_cast<NamespaceDecl>(OuterNS->getParent());
265 if (
const auto *CxxDecl = dyn_cast<CXXRecordDecl>(DC)) {
267 CxxDecl->getDescribedClassTemplate()) {
278 if (!ClassTempl->specializations().empty()) {
279 Decl = *(ClassTempl->spec_begin());
280 Outer = dyn_cast<NamedDecl>(
Decl);
281 OuterNS = dyn_cast<NamespaceDecl>(
Decl);
288 }
else if (
const auto *TD = dyn_cast<TagDecl>(Outer)) {
290 Ctx, TD, FullyQualified, WithGlobalNsPrefix);
311 bool WithGlobalNsPrefix) {
317 if (
const auto *TDT = dyn_cast<TypedefType>(TypePtr)) {
318 Decl = TDT->getDecl();
319 }
else if (
const auto *TagDeclType = dyn_cast<TagType>(TypePtr)) {
320 Decl = TagDeclType->getDecl();
321 }
else if (
const auto *TST = dyn_cast<TemplateSpecializationType>(TypePtr)) {
322 Decl = TST->getTemplateName().getAsTemplateDecl();
331 Ctx,
Decl, FullyQualified, WithGlobalNsPrefix);
336 bool WithGlobalNsPrefix) {
337 while (Namespace && Namespace->isInline()) {
339 Namespace = dyn_cast<NamespaceDecl>(Namespace->getDeclContext());
344 bool FullyQualify =
true;
347 createOuterNNS(Ctx, Namespace, FullyQualify, WithGlobalNsPrefix));
353 bool WithGlobalNsPrefix) {
355 if (
auto *RD = dyn_cast<TagType>(TypePtr)) {
363 }
else if (
auto *TST = dyn_cast<TemplateSpecializationType>(TypePtr)) {
372 bool WithGlobalNsPrefix) {
385 if (
auto *MPT = dyn_cast<MemberPointerType>(QT.
getTypePtr())) {
391 Ctx, MPT->getQualifier(), WithGlobalNsPrefix);
393 MPT->getMostRecentCXXRecordDecl());
418 if (
auto *AT = dyn_cast<AttributedType>(QT.
getTypePtr())) {
443 if (
const auto *TST =
444 dyn_cast<const TemplateSpecializationType>(QT.
getTypePtr())) {
467 Ctx, QT.
getTypePtr(),
true , WithGlobalNsPrefix);
471 if (
const auto *TT = dyn_cast<TagType>(QT.
getTypePtr())) {
477 Ctx, TT, TT->getKeyword(), Prefix, WithGlobalNsPrefix);
479 }
else if (
const auto *TT = dyn_cast<TypedefType>(QT.
getTypePtr())) {
481 TT->getKeyword(), Prefix, TT->getDecl(),
484 assert(!Prefix &&
"Unhandled type node");
493 bool WithGlobalNsPrefix) {
500 bool WithGlobalNsPrefix) {
Defines the C++ template declaration subclasses.
C Language Family Type Representation.
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 getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
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 getTypeDeclType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypeDecl *Decl) const
QualType getTypedefType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypedefNameDecl *Decl, QualType UnderlyingType=QualType(), std::optional< bool > TypeMatchesDeclOrNone=std::nullopt) const
Return the unique reference to the type for the specified typedef-name decl.
QualType getTemplateSpecializationType(ElaboratedTypeKeyword Keyword, TemplateName T, ArrayRef< TemplateArgument > SpecifiedArgs, ArrayRef< TemplateArgument > CanonicalArgs, QualType Underlying=QualType()) const
TemplateName getQualifiedTemplateName(NestedNameSpecifier Qualifier, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getMemberPointerType(QualType T, NestedNameSpecifier Qualifier, const CXXRecordDecl *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
QualType getTagType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TagDecl *TD, bool OwnsTag) 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.
bool isTemplateParameter() const
isTemplateParameter - Determines whether this declaration is a template parameter.
DeclContext * getDeclContext()
Represent a C++ namespace.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
static constexpr NestedNameSpecifier getGlobal()
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
A (possibly-)qualified type.
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 as written in source code.
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.
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(bool IgnoreDeduced=false) 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.
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 bool getFullyQualifiedTemplateName(const ASTContext &Ctx, TemplateName &TName, bool WithGlobalNsPrefix)
static const Type * getFullyQualifiedTemplateType(const ASTContext &Ctx, const TagType *TSTRecord, ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, bool WithGlobalNsPrefix)
static bool getFullyQualifiedTemplateArgument(const ASTContext &Ctx, TemplateArgument &Arg, bool WithGlobalNsPrefix)
static NestedNameSpecifier createNestedNameSpecifier(const ASTContext &Ctx, const NamespaceDecl *Namesp, bool WithGlobalNsPrefix)
Create a NestedNameSpecifier for Namesp and its enclosing scopes.
static NestedNameSpecifier createOuterNNS(const ASTContext &Ctx, const Decl *D, bool FullyQualify, bool WithGlobalNsPrefix)
std::string getFullyQualifiedName(QualType QT, const ASTContext &Ctx, const PrintingPolicy &Policy, bool WithGlobalNsPrefix=false)
Get the fully qualified name for a type.
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.
static NestedNameSpecifier getFullyQualifiedNestedNameSpecifier(const ASTContext &Ctx, NestedNameSpecifier NNS, bool WithGlobalNsPrefix)
Return a fully qualified version of this name specifier.
NestedNameSpecifier getFullyQualifiedDeclaredContext(const ASTContext &Ctx, const Decl *Decl, bool WithGlobalNsPrefix=false)
Get the fully qualified name for the declared context of a declaration.
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.
Top level wrappers for InstallAPI frontend operations.
bool isa(CodeGen::Address addr)
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
const FunctionProtoType * T
@ Keyword
The name has been typo-corrected to a keyword.
U cast(CodeGen::Address addr)
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
Describes how types, statements, expressions, and declarations should be printed.