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);
86 Ctx.getQualifiedTemplateName(NNS,
95 bool WithGlobalNsPrefix) {
123 bool WithGlobalNsPrefix) {
129 const auto *TSTDecl = dyn_cast<ClassTemplateSpecializationDecl>(TD);
131 return Ctx.getTagType(
Keyword, Qualifier, TD,
false)
136 bool MightHaveChanged =
false;
138 for (
unsigned int I = 0,
E = TemplateArgs.
size(); I !=
E; ++I) {
144 FQArgs.push_back(Arg);
147 if (!MightHaveChanged)
148 return Ctx.getTagType(
Keyword, Qualifier, TD,
false)
155 QualType QT = Ctx.getTemplateSpecializationType(
167 bool WithGlobalNsPrefix) {
169 bool MightHaveChanged =
177 FQArgs.push_back(Arg);
180 if (!MightHaveChanged)
184 Ctx.getTemplateSpecializationType(TST->
getKeyword(), TName, FQArgs,
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(),
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);
287 }
else if (isa<TranslationUnitDecl>(Outer)) {
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) {
350 const Type *TypePtr = Ctx.getTypeDeclType(TD).getTypePtr();
351 if (
auto *RD = dyn_cast<TagType>(TypePtr)) {
359 }
else if (
auto *TST = dyn_cast<TemplateSpecializationType>(TypePtr)) {
368 bool WithGlobalNsPrefix) {
375 QT = Ctx.getPointerType(QT);
377 QT = Ctx.getQualifiedType(QT, Quals);
381 if (
auto *MPT = dyn_cast<MemberPointerType>(QT.
getTypePtr())) {
387 Ctx, MPT->getQualifier(), WithGlobalNsPrefix);
388 QT = Ctx.getMemberPointerType(QT, Qualifier,
389 MPT->getMostRecentCXXRecordDecl());
391 QT = Ctx.getQualifiedType(QT, Quals);
399 bool IsLValueRefTy = isa<LValueReferenceType>(QT.
getTypePtr());
405 QT = Ctx.getLValueReferenceType(QT);
407 QT = Ctx.getRValueReferenceType(QT);
409 QT = Ctx.getQualifiedType(QT, Quals);
414 if (
auto *AT = dyn_cast<AttributedType>(QT.
getTypePtr())) {
420 return Ctx.getQualifiedType(
421 Ctx.getAttributedType(AT->getAttrKind(), NewModified, NewEquivalent),
429 while (isa<SubstTemplateTypeParmType>(QT.
getTypePtr())) {
433 QT = cast<SubstTemplateTypeParmType>(QT.
getTypePtr())->desugar();
436 QT = Ctx.getQualifiedType(QT, Quals);
439 if (
const auto *TST =
440 dyn_cast<const TemplateSpecializationType>(QT.
getTypePtr())) {
457 QT = Ctx.getQualifiedType(UT->desugar(), PrefixQualifiers);
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())) {
476 QT = Ctx.getTypedefType(
477 TT->getKeyword(), Prefix, TT->getDecl(),
480 assert(!Prefix &&
"Unhandled type node");
482 QT = Ctx.getQualifiedType(QT, PrefixQualifiers);
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 ...
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()
ElaboratedTypeKeyword getKeyword() const
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.
TagDecl * getOriginalDecl() const
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 type template specialization; the template must be a class template, a type alias templa...
ArrayRef< TemplateArgument > template_arguments() const
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
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.
QualType getCanonicalTypeInternal() const
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.
@ Keyword
The name has been typo-corrected to a keyword.
const FunctionProtoType * T
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.