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);
72 Ctx, NNS, WithGlobalNsPrefix);
81 Ctx, ArgTDecl,
true, WithGlobalNsPrefix);
97 bool WithGlobalNsPrefix) {
123 bool WithGlobalNsPrefix) {
127 assert(!isa<DependentTemplateSpecializationType>(TypePtr));
130 if (
const auto *TST = dyn_cast<const TemplateSpecializationType>(TypePtr)) {
131 bool MightHaveChanged =
false;
137 Ctx, Arg, WithGlobalNsPrefix);
138 FQArgs.push_back(Arg);
143 if (MightHaveChanged) {
145 TST->getTemplateName(), FQArgs,
146 TST->getCanonicalTypeInternal());
152 }
else if (
const auto *TSTRecord = dyn_cast<const RecordType>(TypePtr)) {
157 if (
const auto *TSTDecl =
158 dyn_cast<ClassTemplateSpecializationDecl>(TSTRecord->getDecl())) {
161 bool MightHaveChanged =
false;
163 for (
unsigned int I = 0,
E = TemplateArgs.
size(); I !=
E; ++I) {
168 Ctx, Arg, WithGlobalNsPrefix);
169 FQArgs.push_back(Arg);
174 if (MightHaveChanged) {
178 TSTRecord->getCanonicalTypeInternal());
191 bool WithGlobalNsPrefix) {
193 if (
const auto *NS = dyn_cast<NamespaceDecl>(DC)) {
194 while (NS && NS->isInline()) {
196 NS = dyn_cast<NamespaceDecl>(NS->getDeclContext());
198 if (NS && NS->getDeclName()) {
202 }
else if (
const auto *TD = dyn_cast<TagDecl>(DC)) {
204 }
else if (
const auto *TDD = dyn_cast<TypedefNameDecl>(DC)) {
206 Ctx, TDD, FullyQualify, WithGlobalNsPrefix);
216 bool WithGlobalNsPrefix) {
217 switch (
Scope->getKind()) {
223 Ctx,
Scope->getAsNamespace(), WithGlobalNsPrefix);
231 Scope->getAsNamespaceAlias()->getNamespace()->getCanonicalDecl(),
238 Ctx,
Scope->getPrefix(), WithGlobalNsPrefix);
246 TD = TagDeclType->getDecl();
254 }
else if (
const auto *TDD = dyn_cast<TypedefType>(
Type)) {
262 llvm_unreachable(
"bad NNS kind");
269 bool FullyQualified,
bool WithGlobalNsPrefix) {
273 const auto *Outer = dyn_cast<NamedDecl>(DC);
274 const auto *OuterNS = dyn_cast<NamespaceDecl>(DC);
275 if (Outer && !(OuterNS && OuterNS->isAnonymousNamespace())) {
276 if (
const auto *CxxDecl = dyn_cast<CXXRecordDecl>(DC)) {
278 CxxDecl->getDescribedClassTemplate()) {
289 if (ClassTempl->spec_begin() != ClassTempl->spec_end()) {
290 Decl = *(ClassTempl->spec_begin());
291 Outer = dyn_cast<NamedDecl>(
Decl);
292 OuterNS = dyn_cast<NamespaceDecl>(
Decl);
299 }
else if (
const auto *TD = dyn_cast<TagDecl>(Outer)) {
301 Ctx, TD, FullyQualified, WithGlobalNsPrefix);
302 }
else if (isa<TranslationUnitDecl>(Outer)) {
321 bool FullyQualified,
bool WithGlobalNsPrefix) {
322 if (!TypePtr)
return nullptr;
326 if (
const auto *TDT = dyn_cast<TypedefType>(TypePtr)) {
327 Decl = TDT->getDecl();
328 }
else if (
const auto *TagDeclType = dyn_cast<TagType>(TypePtr)) {
329 Decl = TagDeclType->getDecl();
330 }
else if (
const auto *TST = dyn_cast<TemplateSpecializationType>(TypePtr)) {
331 Decl = TST->getTemplateName().getAsTemplateDecl();
336 if (!
Decl)
return nullptr;
339 Ctx,
Decl, FullyQualified, WithGlobalNsPrefix);
344 bool WithGlobalNsPrefix) {
345 while (Namespace && Namespace->isInline()) {
347 Namespace = dyn_cast<NamespaceDecl>(Namespace->getDeclContext());
349 if (!Namespace)
return nullptr;
351 bool FullyQualified =
true;
354 createOuterNNS(Ctx, Namespace, FullyQualified, WithGlobalNsPrefix),
361 bool WithGlobalNsPrefix) {
363 if (isa<const TemplateSpecializationType>(TypePtr) ||
364 isa<const RecordType>(TypePtr)) {
380 bool WithGlobalNsPrefix) {
393 if (
auto *MPT = dyn_cast<MemberPointerType>(QT.
getTypePtr())) {
410 bool IsLValueRefTy = isa<LValueReferenceType>(QT.
getTypePtr());
428 while (isa<SubstTemplateTypeParmType>(QT.
getTypePtr())) {
432 QT = cast<SubstTemplateTypeParmType>(QT.
getTypePtr())->desugar();
445 if (
const auto *ETypeInput = dyn_cast<ElaboratedType>(QT.
getTypePtr())) {
446 QT = ETypeInput->getNamedType();
448 Keyword = ETypeInput->getKeyword();
465 if (isa<const TemplateSpecializationType>(QT.
getTypePtr()) ||
485 bool WithGlobalNsPrefix) {
Defines the C++ template declaration subclasses.
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 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 ...
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
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 getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) 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 NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, const IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
A (possibly-)qualified type.
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
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.
Represents the declaration of a struct/union/class/enum.
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() 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.
const Type * getTypeForDecl() const
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 NestedNameSpecifier * createOuterNNS(const ASTContext &Ctx, const Decl *D, bool FullyQualify, bool WithGlobalNsPrefix)
static bool getFullyQualifiedTemplateName(const ASTContext &Ctx, TemplateName &TName, bool WithGlobalNsPrefix)
static const Type * getFullyQualifiedTemplateType(const ASTContext &Ctx, const Type *TypePtr, bool WithGlobalNsPrefix)
static NestedNameSpecifier * getFullyQualifiedNestedNameSpecifier(const ASTContext &Ctx, NestedNameSpecifier *scope, bool WithGlobalNsPrefix)
Return a fully qualified version of this name specifier.
static bool getFullyQualifiedTemplateArgument(const ASTContext &Ctx, TemplateArgument &Arg, 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.
std::string getFullyQualifiedName(QualType QT, const ASTContext &Ctx, const PrintingPolicy &Policy, bool WithGlobalNsPrefix=false)
Get the fully qualified name for a type.
static NestedNameSpecifier * createNestedNameSpecifier(const ASTContext &Ctx, const NamespaceDecl *Namesp, bool WithGlobalNsPrefix)
Create a NestedNameSpecifier for Namesp and its enclosing scopes.
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.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
Describes how types, statements, expressions, and declarations should be printed.