24 #include "llvm/Support/raw_ostream.h"
25 using namespace clang;
28 class DeclPrinter :
public DeclVisitor<DeclPrinter> {
32 bool PrintInstantiation;
35 raw_ostream&
Indent(
unsigned Indentation);
51 unsigned Indentation = 0,
bool PrintInstantiation =
false)
52 : Out(Out), Policy(Policy), Indentation(Indentation),
53 PrintInstantiation(PrintInstantiation) { }
98 void prettyPrintAttributes(
Decl *D);
99 void printDeclType(
QualType T, StringRef DeclName,
bool Pack =
false);
104 bool PrintInstantiation)
const {
109 unsigned Indentation,
bool PrintInstantiation)
const {
110 DeclPrinter Printer(Out, Policy, Indentation, PrintInstantiation);
111 Printer.Visit(const_cast<Decl*>(
this));
118 if (isa<TypedefType>(BaseType))
124 else if (
const ArrayType* ATy = dyn_cast<ArrayType>(BaseType))
125 BaseType = ATy->getElementType();
127 BaseType = FTy->getReturnType();
129 BaseType = VTy->getElementType();
133 llvm_unreachable(
"Unknown declarator!");
140 return TDD->getUnderlyingType();
141 if (
ValueDecl* VD = dyn_cast<ValueDecl>(D))
142 return VD->getType();
148 unsigned Indentation) {
150 (*Begin)->print(Out, Policy, Indentation);
161 TD->
print(Out, Policy, Indentation);
167 for ( ; Begin !=
End; ++Begin) {
172 if (!isFirst) Out <<
", ";
176 (*Begin)->print(Out, SubPolicy, Indentation);
186 ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
188 Printer.VisitDeclContext(const_cast<DeclContext *>(
this),
false);
192 for (
unsigned i = 0; i != Indentation; ++i)
197 void DeclPrinter::prettyPrintAttributes(
Decl *D) {
198 if (Policy.PolishForDeclaration)
203 for (AttrVec::const_iterator i=Attrs.begin(), e=Attrs.end(); i!=e; ++i) {
210 void DeclPrinter::printDeclType(
QualType T, StringRef DeclName,
bool Pack) {
216 T = PET->getPattern();
218 T.
print(Out, Policy, (Pack ?
"..." :
"") + DeclName);
231 case AS_none: llvm_unreachable(
"No access specifier!");
243 if (Policy.TerseOutput)
247 Indentation += Policy.Indentation;
255 if (isa<ObjCIvarDecl>(*D))
271 if (!Decls.empty() && !CurDeclType.
isNull()) {
273 if (!BaseType.
isNull() && isa<ElaboratedType>(BaseType))
274 BaseType = cast<ElaboratedType>(BaseType)->getNamedType();
275 if (!BaseType.
isNull() && isa<TagType>(BaseType) &&
276 cast<TagType>(BaseType)->getDecl() == Decls[0]) {
284 ProcessDeclGroup(Decls);
288 if (isa<TagDecl>(*D) && !cast<TagDecl>(*D)->getIdentifier()) {
293 if (isa<AccessSpecDecl>(*D)) {
294 Indentation -= Policy.Indentation;
298 Indentation += Policy.Indentation;
306 const char *Terminator =
nullptr;
307 if (isa<OMPThreadPrivateDecl>(*D))
308 Terminator =
nullptr;
309 else if (isa<FunctionDecl>(*D) &&
310 cast<FunctionDecl>(*D)->isThisDeclarationADefinition())
311 Terminator =
nullptr;
312 else if (isa<ObjCMethodDecl>(*D) && cast<ObjCMethodDecl>(*D)->getBody())
313 Terminator =
nullptr;
314 else if (isa<NamespaceDecl>(*D) || isa<LinkageSpecDecl>(*D) ||
315 isa<ObjCImplementationDecl>(*D) ||
316 isa<ObjCInterfaceDecl>(*D) ||
317 isa<ObjCProtocolDecl>(*D) ||
318 isa<ObjCCategoryImplDecl>(*D) ||
319 isa<ObjCCategoryDecl>(*D))
320 Terminator =
nullptr;
321 else if (isa<EnumConstantDecl>(*D)) {
335 ProcessDeclGroup(Decls);
338 Indentation -= Policy.Indentation;
342 VisitDeclContext(D,
false);
345 void DeclPrinter::VisitTypedefDecl(
TypedefDecl *D) {
346 if (!Policy.SuppressSpecifiers) {
350 Out <<
"__module_private__ ";
353 prettyPrintAttributes(D);
357 Out <<
"using " << *D;
358 prettyPrintAttributes(D);
359 Out <<
" = " << D->getTypeSourceInfo()->getType().getAsString(Policy);
362 void DeclPrinter::VisitEnumDecl(
EnumDecl *D) {
364 Out <<
"__module_private__ ";
377 if (D->isCompleteDefinition()) {
382 prettyPrintAttributes(D);
385 void DeclPrinter::VisitRecordDecl(
RecordDecl *D) {
387 Out <<
"__module_private__ ";
390 prettyPrintAttributes(D);
404 if (
Expr *Init = D->getInitExpr()) {
406 Init->printPretty(Out,
nullptr, Policy, Indentation);
413 if (!Policy.SuppressSpecifiers) {
420 llvm_unreachable(
"invalid for functions");
428 (ConversionDecl && ConversionDecl->isExplicit()))
433 SubPolicy.SuppressSpecifiers =
false;
437 while (
const ParenType *PT = dyn_cast<ParenType>(Ty)) {
438 Proto =
'(' + Proto +
')';
439 Ty = PT->getInnerType();
445 FT = dyn_cast<FunctionProtoType>(AFT);
449 llvm::raw_string_ostream POut(Proto);
450 DeclPrinter ParamPrinter(POut, SubPolicy, Indentation);
451 for (
unsigned i = 0, e = D->
getNumParams(); i != e; ++i) {
461 for (
unsigned i = 0, e = D->
getNumParams(); i != e; ++i) {
474 Proto +=
" volatile";
476 Proto +=
" restrict";
503 Proto +=
" noexcept";
506 llvm::raw_string_ostream EOut(Proto);
516 bool HasInitializerList =
false;
517 for (
const auto *BMInitializer : CDecl->
inits()) {
518 if (BMInitializer->isInClassMemberInitializer())
521 if (!HasInitializerList) {
525 HasInitializerList =
true;
529 if (BMInitializer->isAnyMemberInitializer()) {
530 FieldDecl *FD = BMInitializer->getAnyMember();
533 Out <<
QualType(BMInitializer->getBaseClass(), 0).getAsString(Policy);
537 if (!BMInitializer->getInit()) {
540 Expr *Init = BMInitializer->getInit();
542 Init = Tmp->getSubExpr();
546 Expr *SimpleInit =
nullptr;
547 Expr **Args =
nullptr;
548 unsigned NumArgs = 0;
549 if (
ParenListExpr *ParenList = dyn_cast<ParenListExpr>(Init)) {
550 Args = ParenList->getExprs();
551 NumArgs = ParenList->getNumExprs();
553 = dyn_cast<CXXConstructExpr>(Init)) {
554 Args = Construct->getArgs();
555 NumArgs = Construct->getNumArgs();
560 SimpleInit->printPretty(Out,
nullptr, Policy, Indentation);
562 for (
unsigned I = 0; I != NumArgs; ++I) {
563 assert(Args[I] !=
nullptr &&
"Expected non-null Expr");
564 if (isa<CXXDefaultArgExpr>(Args[I]))
569 Args[I]->printPretty(Out,
nullptr, Policy, Indentation);
574 if (BMInitializer->isPackExpansion())
577 }
else if (!ConversionDecl && !isa<CXXDestructorDecl>(D)) {
579 Out <<
"auto " << Proto <<
" -> ";
582 AFT->getReturnType().print(Out, Policy, Proto);
587 Ty.
print(Out, Policy, Proto);
590 prettyPrintAttributes(D);
603 DeclPrinter ParamPrinter(Out, SubPolicy, Indentation);
604 Indentation += Policy.Indentation;
605 for (
unsigned i = 0, e = D->
getNumParams(); i != e; ++i) {
610 Indentation -= Policy.Indentation;
615 D->
getBody()->printPretty(Out,
nullptr, SubPolicy, Indentation);
620 void DeclPrinter::VisitFriendDecl(
FriendDecl *D) {
623 for (
unsigned i = 0; i < NumTPLists; ++i)
626 Out <<
" " << TSI->getType().getAsString(Policy);
631 VisitFunctionDecl(FD);
636 VisitFunctionTemplateDecl(FTD);
641 VisitRedeclarableTemplateDecl(CTD);
645 void DeclPrinter::VisitFieldDecl(
FieldDecl *D) {
646 if (!Policy.SuppressSpecifiers && D->
isMutable())
649 Out <<
"__module_private__ ";
656 D->
getBitWidth()->printPretty(Out,
nullptr, Policy, Indentation);
660 if (!Policy.SuppressInitializers && Init) {
665 Init->printPretty(Out,
nullptr, Policy, Indentation);
667 prettyPrintAttributes(D);
670 void DeclPrinter::VisitLabelDecl(
LabelDecl *D) {
674 void DeclPrinter::VisitVarDecl(
VarDecl *D) {
675 if (!Policy.SuppressSpecifiers) {
687 Out <<
"_Thread_local ";
690 Out <<
"thread_local ";
695 Out <<
"__module_private__ ";
701 printDeclType(T, D->
getName());
703 if (!Policy.SuppressInitializers && Init) {
704 bool ImplicitInit =
false;
706 dyn_cast<CXXConstructExpr>(Init->IgnoreImplicit())) {
708 !Construct->isListInitialization()) {
709 ImplicitInit = Construct->getNumArgs() == 0 ||
719 Init->printPretty(Out,
nullptr, Policy, Indentation);
724 prettyPrintAttributes(D);
727 void DeclPrinter::VisitParmVarDecl(
ParmVarDecl *D) {
733 D->
getAsmString()->printPretty(Out,
nullptr, Policy, Indentation);
737 void DeclPrinter::VisitImportDecl(
ImportDecl *D) {
743 Out <<
"static_assert(";
744 D->
getAssertExpr()->printPretty(Out,
nullptr, Policy, Indentation);
747 SL->printPretty(Out,
nullptr, Policy, Indentation);
758 Out <<
"namespace " << *D <<
" {\n";
764 Out <<
"using namespace ";
771 Out <<
"namespace " << *D <<
" = ";
772 if (D->getQualifier())
774 Out << *D->getAliasedNamespace();
777 void DeclPrinter::VisitEmptyDecl(
EmptyDecl *D) {
778 prettyPrintAttributes(D);
783 Out <<
"__module_private__ ";
786 prettyPrintAttributes(D);
800 if (
Base->isVirtual())
808 Out <<
Base->getType().getAsString(Policy);
810 if (
Base->isPackExpansion())
829 "unknown language in linkage specification");
833 Out <<
"extern \"" << l <<
"\" ";
845 assert(!Args || Params->
size() == Args->
size());
849 for (
unsigned i = 0, e = Params->
size(); i != e; ++i) {
855 dyn_cast<TemplateTypeParmDecl>(Param)) {
857 if (TTP->wasDeclaredWithTypename())
862 if (TTP->isParameterPack())
870 }
else if (TTP->hasDefaultArgument()) {
872 Out << TTP->getDefaultArgument().getAsString(Policy);
875 dyn_cast<NonTypeTemplateParmDecl>(Param)) {
878 Name = II->getName();
879 printDeclType(NTTP->getType(), Name, NTTP->isParameterPack());
884 }
else if (NTTP->hasDefaultArgument()) {
886 NTTP->getDefaultArgument()->printPretty(Out,
nullptr, Policy,
890 dyn_cast<TemplateTemplateParmDecl>(Param)) {
891 VisitTemplateDecl(TTPD);
899 void DeclPrinter::VisitTemplateDecl(
const TemplateDecl *D) {
903 dyn_cast<TemplateTemplateParmDecl>(D)) {
905 if (TTP->isParameterPack())
914 if (PrintInstantiation) {
917 PrintTemplateParameters(Params, I->getTemplateSpecializationArgs());
922 return VisitRedeclarableTemplateDecl(D);
926 if (PrintInstantiation) {
929 PrintTemplateParameters(Params, &I->getTemplateArgs());
935 return VisitRedeclarableTemplateDecl(D);
942 void DeclPrinter::PrintObjCMethodType(
ASTContext &Ctx,
946 if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_In)
948 if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_Inout)
950 if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_Out)
952 if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_Bycopy)
954 if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_Byref)
956 if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_Oneway)
958 if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_CSNullability) {
969 unsigned First =
true;
970 for (
auto *Param : *Params) {
977 switch (Param->getVariance()) {
982 Out <<
"__covariant ";
986 Out <<
"__contravariant ";
990 Out << Param->getDeclName().getAsString();
992 if (Param->hasExplicitBound()) {
993 Out <<
" : " << Param->getUnderlyingType().getAsString(Policy);
1010 std::string::size_type pos, lastPos = 0;
1011 for (
const auto *PI : OMD->
params()) {
1013 pos = name.find_first_of(
':', lastPos);
1014 Out <<
" " << name.substr(lastPos, pos - lastPos) <<
':';
1016 PI->getObjCDeclQualifier(),
1028 prettyPrintAttributes(OMD);
1030 if (OMD->
getBody() && !Policy.TerseOutput) {
1032 OMD->
getBody()->printPretty(Out,
nullptr, Policy);
1034 else if (Policy.PolishForDeclaration)
1042 bool eolnOut =
false;
1044 Out <<
"@implementation " << I <<
" : " << *SID;
1046 Out <<
"@implementation " << I;
1051 Indentation += Policy.Indentation;
1052 for (
const auto *I : OID->
ivars()) {
1053 Indent() << I->getASTContext().getUnqualifiedObjCPointerType(I->getType()).
1054 getAsString(Policy) <<
' ' << *I <<
";\n";
1056 Indentation -= Policy.Indentation;
1063 VisitDeclContext(OID,
false);
1074 Out <<
"@class " << I;
1077 PrintObjCTypeParams(TypeParams);
1083 bool eolnOut =
false;
1084 Out <<
"@interface " << I;
1087 PrintObjCTypeParams(TypeParams);
1095 if (!Protocols.
empty()) {
1097 E = Protocols.
end(); I != E; ++I)
1098 Out << (I == Protocols.
begin() ?
'<' :
',') << **I;
1105 Indentation += Policy.Indentation;
1106 for (
const auto *I : OID->
ivars()) {
1107 Indent() << I->getASTContext()
1108 .getUnqualifiedObjCPointerType(I->getType())
1109 .getAsString(Policy) <<
' ' << *I <<
";\n";
1111 Indentation -= Policy.Indentation;
1119 VisitDeclContext(OID,
false);
1128 Out <<
"@protocol " << *PID <<
";\n";
1133 if (!Protocols.
empty()) {
1134 Out <<
"@protocol " << *PID;
1136 E = Protocols.
end(); I != E; ++I)
1137 Out << (I == Protocols.
begin() ?
'<' :
',') << **I;
1140 Out <<
"@protocol " << *PID <<
'\n';
1141 VisitDeclContext(PID,
false);
1148 VisitDeclContext(PID,
false);
1156 PrintObjCTypeParams(TypeParams);
1158 Out <<
"(" << *PID <<
")\n";
1159 if (PID->ivar_size() > 0) {
1161 Indentation += Policy.Indentation;
1162 for (
const auto *I : PID->ivars())
1163 Indent() << I->getASTContext().getUnqualifiedObjCPointerType(I->getType()).
1164 getAsString(Policy) <<
' ' << *I <<
";\n";
1165 Indentation -= Policy.Indentation;
1169 VisitDeclContext(PID,
false);
1176 Out <<
"@compatibility_alias " << *AID
1184 Out <<
"@required\n";
1186 Out <<
"@optional\n";
1196 Out << (first ?
' ' :
',') <<
"readonly";
1201 Out << (first ?
' ' :
',') <<
"getter = ";
1206 Out << (first ?
' ' :
',') <<
"setter = ";
1212 Out << (first ?
' ' :
',') <<
"assign";
1218 Out << (first ?
' ' :
',') <<
"readwrite";
1223 Out << (first ?
' ' :
',') <<
"retain";
1228 Out << (first ?
' ' :
',') <<
"strong";
1233 Out << (first ?
' ' :
',') <<
"copy";
1239 Out << (first ?
' ' :
',') <<
"nonatomic";
1244 Out << (first ?
' ' :
',') <<
"atomic";
1254 Out << (first ?
' ' :
',') <<
"null_resettable";
1256 Out << (first ?
' ' :
',')
1267 getAsString(Policy) <<
' ' << *PDecl;
1268 if (Policy.PolishForDeclaration)
1274 Out <<
"@synthesize ";
1282 void DeclPrinter::VisitUsingDecl(
UsingDecl *D) {
1293 Out <<
"using typename ";
1310 Out <<
"#pragma omp threadprivate";
1316 NamedDecl *ND = cast<NamedDecl>(cast<DeclRefExpr>(*I)->getDecl());
param_const_iterator param_begin() const
Defines the clang::ASTContext interface.
QualType getExceptionType(unsigned i) const
TemplateParameterList * getFriendTypeTemplateParameterList(unsigned N) const
void VisitVarDecl(VarDecl *VD)
StringRef getName() const
void VisitImportDecl(ImportDecl *D)
void VisitUsingDecl(UsingDecl *D)
ObjCInterfaceDecl * getClassInterface()
bool isBitField() const
Determines whether this field is a bitfield.
spec_range specializations() const
IdentifierInfo * getIdentifier() const
void VisitFieldDecl(FieldDecl *FD)
PropertyControl getPropertyImplementation() const
void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D)
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
void VisitEnumConstantDecl(EnumConstantDecl *ECD)
Defines the clang::Module class, which describes a module in the source code.
std::string getAsString() const
void VisitObjCCategoryDecl(ObjCCategoryDecl *D)
Represents an empty-declaration.
const Expr * getInit() const
NamespaceDecl - Represent a C++ namespace.
Represents a call to a C++ constructor.
NamedDecl * getParam(unsigned Idx)
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
A container of type source information.
static void printGroup(Decl **Begin, unsigned NumDecls, raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation=0)
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
Represents a C++ constructor within a class.
Expr * getInClassInitializer() const
InClassInitStyle getInClassInitStyle() const
void VisitStaticAssertDecl(StaticAssertDecl *D)
AccessSpecifier getAccess() const
void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const
void VisitClassTemplateDecl(ClassTemplateDecl *D)
Stores a list of template parameters for a TemplateDecl and its derived classes.
Describes how types, statements, expressions, and declarations should be printed. ...
decl_iterator decls_end() const
void VisitTypeAliasDecl(TypeAliasDecl *TD)
ParmVarDecl - Represents a parameter to a function.
Defines the clang::Expr interface and subclasses for C++ expressions.
bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType)
TypeSourceInfo * getFriendType() const
Kind getPropertyImplementation() const
unsigned ivar_size() const
std::string getFullModuleName() const
Retrieve the full name of this module, including the path from its top-level module.
ObjCTypeParamList * getTypeParamListAsWritten() const
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
unsigned getFriendTypeNumTemplateParameterLists() const
StringLiteral * getMessage()
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
bool isExplicitSpecified() const
Determine whether this constructor declaration has the explicit keyword specified.
std::string getNameAsString() const
Get the name of the class associated with this interface.
bool isCompleteDefinition() const
bool isTranslationUnit() const
unsigned size() const
Retrieve the number of template arguments in this template argument list.
bool varlist_empty() const
void VisitFileScopeAsmDecl(FileScopeAsmDecl *AD)
void VisitLabelDecl(LabelDecl *LD)
bool hasBraces() const
Determines whether this linkage specification had braces in its syntactic form.
StorageClass getStorageClass() const
Returns the storage class as written in the source. For the computed linkage of symbol, see getLinkage.
bool isExplicitlyDefaulted() const
Represents a C++ using-declaration.
void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
An lvalue ref-qualifier was provided (&).
static QualType getDeclType(Decl *D)
bool isInline() const
Returns true if this is an inline namespace declaration.
ObjCTypeParamList * getTypeParamList() const
Microsoft throw(...) extension.
NamedDecl * getNominatedNamespaceAsWritten()
void VisitCXXRecordDecl(CXXRecordDecl *D)
Expr * getNoexceptExpr() const
void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D)
Selector getSetterName() const
DeclID VisitTemplateDecl(TemplateDecl *D)
std::string getNameAsString() const
base_class_iterator bases_begin()
Represents an Objective-C protocol declaration.
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
Represents an ObjC class declaration.
Represents a linkage specification.
decl_iterator decls_begin() const
PropertyAttributeKind getPropertyAttributes() const
bool hasPrototype() const
Whether this function has a prototype, either because one was explicitly written or because it was "i...
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
void VisitParmVarDecl(ParmVarDecl *PD)
ObjCDeclQualifier getObjCDeclQualifier() const
void VisitLinkageSpecDecl(LinkageSpecDecl *D)
MutableArrayRef< Expr * >::iterator varlist_iterator
StorageClass getStorageClass() const
Returns the storage class as written in the source. For the computed linkage of symbol, see getLinkage.
QualType getPointeeType() const
void VisitUsingShadowDecl(UsingShadowDecl *D)
void VisitFriendDecl(FriendDecl *D)
bool isDeletedAsWritten() const
Declaration of a template type parameter.
ObjCIvarDecl * getPropertyIvarDecl() const
Expr * getBitWidth() const
void VisitTypedefDecl(TypedefDecl *TD)
QualType getUnqualifiedObjCPointerType(QualType type) const
const ParmVarDecl * getParamDecl(unsigned i) const
static QualType GetBaseType(QualType T)
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine()) const
StorageClass
Storage classes.
bool isInstanceMethod() const
bool hasTrailingReturn() const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
DeclarationName getDeclName() const
unsigned getNumBases() const
Retrieves the number of base classes of this class.
unsigned ivar_size() const
Represents a C++ conversion function within a class.
void VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
TypeSourceInfo * getTypeSourceInfo() const
const clang::PrintingPolicy & getPrintingPolicy() const
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of the namespace.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
void VisitObjCProtocolDecl(ObjCProtocolDecl *D)
param_const_iterator param_end() const
Stmt * getBody(const FunctionDecl *&Definition) const
bool doesThisDeclarationHaveABody() const
unsigned getNumParams() const
bool SuppressTag
Whether type printing should skip printing the actual tag type.
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
const ObjCInterfaceDecl * getClassInterface() const
void VisitEmptyDecl(EmptyDecl *D)
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
bool SuppressSpecifiers
Whether we should suppress printing of the actual specifiers for the given type or declaration...
TagDecl - Represents the declaration of a struct/union/class/enum.
ASTContext & getASTContext() const LLVM_READONLY
Represents a dependent using declaration which was not marked with typename.
std::string getAsString() const
getAsString - Retrieve the human-readable string for this name.
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
void print(const PrintingPolicy &Policy, raw_ostream &Out) const
Print this template argument to the given output stream.
varlist_iterator varlist_begin()
No ref-qualifier was provided.
C-style initialization with assignment.
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
const ObjCInterfaceDecl * getClassInterface() const
Direct list-initialization.
ThreadStorageClassSpecifier getTSCSpec() const
std::string getAsString() const
Derive the full selector name (e.g. "foo:bar:") and return it as an std::string.
Represents one property declaration in an Objective-C interface.
A simple visitor class that helps create declaration visitors.
void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
QualType getReturnType() const
void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D)
void VisitRecordDecl(RecordDecl *RD)
Represents a C++11 static_assert declaration.
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
An rvalue ref-qualifier was provided (&&).
QualType getType() const
Return the type wrapped by this type source info.
void printQualifiedName(raw_ostream &OS) const
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a pack expansion of types.
static const char * getStorageClassSpecifierString(StorageClass SC)
void VisitEnumDecl(EnumDecl *ED)
Base class for declarations which introduce a typedef-name.
const ObjCProtocolList & getReferencedProtocols() const
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
Print this nested name specifier to the given output stream.
bool hasTypename() const
Return true if the using declaration has 'typename'.
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
The base class of all kinds of template declarations (e.g., class, function, etc.).
void VisitFunctionDecl(FunctionDecl *FD)
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
bool hasWrittenPrototype() const
Represents a dependent using declaration which was marked with typename.
void VisitObjCMethodDecl(ObjCMethodDecl *D)
Selector getGetterName() const
void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
void VisitObjCImplementationDecl(ObjCImplementationDecl *D)
Selector getSelector() const
void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D)
spec_range specializations() const
void VisitObjCPropertyDecl(ObjCPropertyDecl *D)
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
NamedDecl * getFriendDecl() const
bool isSpecifierType() const
QualType getIntegerType() const
void VisitNamespaceDecl(NamespaceDecl *D)
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
const ObjCProtocolList & getReferencedProtocols() const
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of the namespace.
Represents a base class of a C++ class.
void VisitUsingDirectiveDecl(UsingDirectiveDecl *D)
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
A template argument list.
ObjCPropertyDecl * getPropertyDecl() const
varlist_iterator varlist_end()
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Call-style initialization (C++98)
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Represents a C++ struct/union/class.
bool hasDynamicExceptionSpec() const
Return whether this function has a dynamic (throw) exception spec.
base_class_iterator bases_end()
Declaration of a class template.
void dumpDeclContext() const
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
ObjCInterfaceDecl * getSuperClass() const
TranslationUnitDecl - The top declaration context.
std::pair< uint64_t, uint64_t > VisitDeclContext(DeclContext *DC)
void VisitFunctionTemplateDecl(FunctionTemplateDecl *D)
StringRef getKindName() const
DeclarationNameInfo getNameInfo() const
Represents a C++ namespace alias.
Represents C++ using-directive.
bool isNull() const
isNull - Return true if this QualType doesn't point to a type yet.
TypeSourceInfo * getTypeSourceInfo() const
llvm::StringRef getNullabilitySpelling(NullabilityKind kind, bool isContextSensitive=false)
Retrieve the spelling of the given nullability kind.
void VisitTranslationUnitDecl(TranslationUnitDecl *TU)
This represents '#pragma omp threadprivate ...' directive. For example, in the following, both 'a' and 'A::b' are threadprivate:
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined...
The parameter is invariant: must match exactly.
Declaration of a template function.
Attr - This represents one attribute.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Expr * IgnoreParens() LLVM_READONLY
StreamedQualTypeHelper stream(const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine()) const
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
unsigned getNumExceptions() const
const ObjCInterfaceDecl * getSuperClass() const
const StringLiteral * getAsmString() const