27static NestedNameSpecifier
29 bool WithGlobalNsPrefix);
44 bool WithGlobalNsPrefix);
46static NestedNameSpecifier
49 bool WithGlobalNsPrefix);
52 const ASTContext &Ctx, NestedNameSpecifier NNS,
bool WithGlobalNsPrefix);
56 bool WithGlobalNsPrefix) {
63 assert(ArgTDecl !=
nullptr);
79 Ctx, ArgTDecl,
true, WithGlobalNsPrefix);
95 bool WithGlobalNsPrefix) {
120 const TagType *TSTRecord,
123 bool WithGlobalNsPrefix) {
128 const auto *TD = TSTRecord->getOriginalDecl();
129 const auto *TSTDecl = dyn_cast<ClassTemplateSpecializationDecl>(TD);
136 bool MightHaveChanged =
false;
138 for (
unsigned int I = 0, E = TemplateArgs.
size(); I != E; ++I) {
144 FQArgs.push_back(Arg);
147 if (!MightHaveChanged)
157 {}, TSTRecord->getCanonicalTypeInternal());
166 const TemplateSpecializationType *TST,
167 bool WithGlobalNsPrefix) {
169 bool MightHaveChanged =
177 FQArgs.push_back(Arg);
180 if (!MightHaveChanged)
194 bool WithGlobalNsPrefix) {
196 if (
const auto *NS = dyn_cast<NamespaceDecl>(DC)) {
197 while (NS && NS->isInline()) {
199 NS = dyn_cast<NamespaceDecl>(NS->getDeclContext());
201 if (NS && NS->getDeclName()) {
206 if (
const auto *TD = dyn_cast<TagDecl>(DC))
208 if (
const auto *TDD = dyn_cast<TypedefNameDecl>(DC))
219 switch (
Scope.getKind()) {
221 llvm_unreachable(
"can't fully qualify the empty nested name specifier");
228 Ctx,
Scope.getAsNamespaceAndPrefix().Namespace->getNamespace(),
234 if (
const TagType *TagDeclType =
Type->
getAs<TagType>())
235 TD = TagDeclType->getOriginalDecl();
236 else if (
const auto *D = dyn_cast<TypedefType>(
Type))
244 llvm_unreachable(
"bad NNS kind");
252 bool WithGlobalNsPrefix) {
256 const auto *Outer = dyn_cast<NamedDecl>(DC);
257 const auto *OuterNS = dyn_cast<NamespaceDecl>(DC);
258 if (OuterNS && OuterNS->isAnonymousNamespace())
259 OuterNS = dyn_cast<NamespaceDecl>(OuterNS->getParent());
261 if (
const auto *CxxDecl = dyn_cast<CXXRecordDecl>(DC)) {
263 CxxDecl->getDescribedClassTemplate()) {
274 if (!ClassTempl->specializations().empty()) {
275 Decl = *(ClassTempl->spec_begin());
276 Outer = dyn_cast<NamedDecl>(
Decl);
277 OuterNS = dyn_cast<NamespaceDecl>(
Decl);
284 }
else if (
const auto *TD = dyn_cast<TagDecl>(Outer)) {
286 Ctx, TD, FullyQualified, WithGlobalNsPrefix);
307 bool WithGlobalNsPrefix) {
313 if (
const auto *TDT = dyn_cast<TypedefType>(TypePtr)) {
314 Decl = TDT->getDecl();
315 }
else if (
const auto *TagDeclType = dyn_cast<TagType>(TypePtr)) {
316 Decl = TagDeclType->getOriginalDecl();
317 }
else if (
const auto *TST = dyn_cast<TemplateSpecializationType>(TypePtr)) {
318 Decl = TST->getTemplateName().getAsTemplateDecl();
327 Ctx,
Decl, FullyQualified, WithGlobalNsPrefix);
332 bool WithGlobalNsPrefix) {
333 while (Namespace && Namespace->isInline()) {
335 Namespace = dyn_cast<NamespaceDecl>(Namespace->getDeclContext());
340 bool FullyQualify =
true;
343 createOuterNNS(Ctx, Namespace, FullyQualify, WithGlobalNsPrefix));
349 bool WithGlobalNsPrefix) {
351 if (
auto *RD = dyn_cast<TagType>(TypePtr)) {
359 }
else if (
auto *TST = dyn_cast<TemplateSpecializationType>(TypePtr)) {
368 bool WithGlobalNsPrefix) {
381 if (
auto *MPT = dyn_cast<MemberPointerType>(QT.
getTypePtr())) {
387 Ctx, MPT->getQualifier(), WithGlobalNsPrefix);
389 MPT->getMostRecentCXXRecordDecl());
414 if (
auto *AT = dyn_cast<AttributedType>(QT.
getTypePtr())) {
439 if (
const auto *TST =
440 dyn_cast<const TemplateSpecializationType>(QT.
getTypePtr())) {
463 Ctx, QT.
getTypePtr(),
true , WithGlobalNsPrefix);
467 if (
const auto *TT = dyn_cast<TagType>(QT.
getTypePtr())) {
473 Ctx, TT, TT->getKeyword(), Prefix, WithGlobalNsPrefix);
475 }
else if (
const auto *TT = dyn_cast<TypedefType>(QT.
getTypePtr())) {
477 TT->getKeyword(), Prefix, TT->getDecl(),
480 assert(!Prefix &&
"Unhandled type node");
489 bool WithGlobalNsPrefix) {
496 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.
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.
The JSON file list parser is used to communicate input to InstallAPI.
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.