29 #include "llvm/Support/raw_ostream.h"
30 using namespace clang;
31 using namespace clang::comments;
41 struct TerminalColor {
42 raw_ostream::Colors Color;
57 static const TerminalColor DeclKindNameColor = { raw_ostream::GREEN,
true };
59 static const TerminalColor AttrColor = { raw_ostream::BLUE,
true };
61 static const TerminalColor StmtColor = { raw_ostream::MAGENTA,
true };
63 static const TerminalColor CommentColor = { raw_ostream::BLUE,
false };
66 static const TerminalColor TypeColor = { raw_ostream::GREEN,
false };
69 static const TerminalColor AddressColor = { raw_ostream::YELLOW,
false };
71 static const TerminalColor LocationColor = { raw_ostream::YELLOW,
false };
74 static const TerminalColor ValueKindColor = { raw_ostream::CYAN,
false };
76 static const TerminalColor ObjectKindColor = { raw_ostream::CYAN,
false };
79 static const TerminalColor NullColor = { raw_ostream::BLUE,
false };
82 static const TerminalColor UndeserializedColor = { raw_ostream::GREEN,
true };
85 static const TerminalColor CastColor = { raw_ostream::RED,
false };
88 static const TerminalColor ValueColor = { raw_ostream::CYAN,
true };
90 static const TerminalColor DeclNameColor = { raw_ostream::CYAN,
true };
93 static const TerminalColor IndentColor = { raw_ostream::BLUE,
false };
107 bool Deserialize =
false;
110 bool TopLevel =
true;
113 bool FirstChild =
true;
120 const char *LastLocFilename =
"";
121 unsigned LastLocLine = ~0U;
129 template<
typename Fn>
void dumpChild(Fn doDumpChild) {
135 while (!Pending.empty()) {
136 Pending.back()(
true);
146 auto dumpWithIndent = [
this, doDumpChild, OrigFC](
bool isLastChild) {
161 ColorScope Color(*
this, IndentColor);
162 OS << Prefix << (isLastChild ?
'`' :
'|') <<
'-';
163 this->Prefix.push_back(isLastChild ?
' ' :
'|');
164 this->Prefix.push_back(
' ');
168 unsigned Depth = Pending.size();
175 while (Depth < Pending.size()) {
176 Pending.back()(
true);
177 this->Pending.pop_back();
181 this->Prefix.resize(Prefix.size() - 2);
185 Pending.push_back(std::move(dumpWithIndent));
187 Pending.back()(
false);
188 Pending.back() = std::move(dumpWithIndent);
196 ColorScope(ASTDumper &Dumper, TerminalColor Color)
198 if (Dumper.ShowColors)
199 Dumper.OS.changeColor(Color.Color, Color.Bold);
202 if (Dumper.ShowColors)
203 Dumper.OS.resetColor();
210 : OS(OS), Traits(Traits), SM(SM),
211 ShowColors(SM && SM->getDiagnostics().getShowColors()) { }
215 : OS(OS), Traits(Traits), SM(SM), ShowColors(ShowColors) {}
217 void setDeserialize(
bool D) { Deserialize = D; }
219 void dumpDecl(
const Decl *D);
220 void dumpStmt(
const Stmt *
S);
224 void dumpPointer(
const void *Ptr);
230 void dumpTypeAsChild(
const Type *T);
231 void dumpBareDeclRef(
const Decl *
Node);
232 void dumpDeclRef(
const Decl *
Node,
const char *
Label =
nullptr);
236 void dumpLookups(
const DeclContext *DC,
bool DumpDecls);
237 void dumpAttr(
const Attr *A);
267 OS <<
" written as lvalue reference";
268 VisitReferenceType(T);
274 void VisitArrayType(
const ArrayType *T) {
299 void VisitDependentSizedExtVectorType(
320 if (EI.getNoReturn()) OS <<
" noreturn";
321 if (EI.getProducesResult()) OS <<
" produces_result";
322 if (EI.getHasRegParm()) OS <<
" regparm " << EI.
getRegParm();
328 if (EPI.HasTrailingReturn) OS <<
" trailing_return";
329 if (T->
isConst()) OS <<
" const";
332 switch (EPI.RefQualifier) {
339 VisitFunctionType(T);
343 dumpChild([=] { OS <<
"..."; });
360 OS <<
" underlying_type";
365 void VisitTagType(
const TagType *T) {
380 void VisitSubstTemplateTypeParmPackType(
385 void VisitAutoType(
const AutoType *T) {
394 dumpTemplateArgument(Arg);
395 if (T->isTypeAlias())
396 dumpTypeAsChild(T->getAliasedType());
410 void VisitPipeType(
const PipeType *T) {
427 void VisitEnumDecl(
const EnumDecl *D);
433 void VisitVarDecl(
const VarDecl *D);
455 template<
typename SpecializationDecl>
456 void VisitTemplateDeclSpecialization(
const SpecializationDecl *D,
457 bool DumpExplicitInst,
459 template<
typename TemplateDecl>
460 void VisitTemplateDecl(
const TemplateDecl *D,
bool DumpExplicitInst);
463 void VisitClassTemplateSpecializationDecl(
465 void VisitClassTemplatePartialSpecializationDecl(
467 void VisitClassScopeFunctionSpecializationDecl(
471 void VisitVarTemplateSpecializationDecl(
473 void VisitVarTemplatePartialSpecializationDecl(
569 const char *getCommandName(
unsigned CommandID);
570 void dumpComment(
const Comment *C);
592 void ASTDumper::dumpPointer(
const void *Ptr) {
593 ColorScope Color(*
this, AddressColor);
601 ColorScope Color(*
this, LocationColor);
609 OS <<
"<invalid sloc>";
613 if (strcmp(PLoc.
getFilename(), LastLocFilename) != 0) {
618 }
else if (PLoc.
getLine() != LastLocLine) {
619 OS <<
"line" <<
':' << PLoc.
getLine()
645 ColorScope Color(*
this, TypeColor);
650 if (Desugar && !T.
isNull()) {
653 if (T_split != D_split)
658 void ASTDumper::dumpType(
QualType T) {
663 void ASTDumper::dumpTypeAsChild(
QualType T) {
666 return dumpTypeAsChild(SQT.
Ty);
672 dumpBareType(T,
false);
678 void ASTDumper::dumpTypeAsChild(
const Type *T) {
681 ColorScope Color(*
this, NullColor);
685 if (
const LocInfoType *LIT = llvm::dyn_cast<LocInfoType>(T)) {
687 ColorScope Color(*
this, TypeColor);
688 OS <<
"LocInfo Type";
691 dumpTypeAsChild(LIT->getTypeSourceInfo()->getType());
696 ColorScope Color(*
this, TypeColor);
701 dumpBareType(
QualType(T, 0),
false);
705 if (SingleStepDesugar !=
QualType(T, 0))
710 OS <<
" instantiation_dependent";
712 OS <<
" variably_modified";
714 OS <<
" contains_unexpanded_pack";
720 if (SingleStepDesugar !=
QualType(T, 0))
721 dumpTypeAsChild(SingleStepDesugar);
725 void ASTDumper::dumpBareDeclRef(
const Decl *D) {
727 ColorScope Color(*
this, NullColor);
733 ColorScope Color(*
this, DeclKindNameColor);
738 if (
const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
739 ColorScope Color(*
this, DeclNameColor);
740 OS <<
" '" << ND->getDeclName() <<
'\'';
743 if (
const ValueDecl *VD = dyn_cast<ValueDecl>(D))
744 dumpType(VD->getType());
747 void ASTDumper::dumpDeclRef(
const Decl *D,
const char *
Label) {
758 void ASTDumper::dumpName(
const NamedDecl *ND) {
760 ColorScope Color(*
this, DeclNameColor);
774 void ASTDumper::dumpDeclContext(
const DeclContext *DC) {
783 ColorScope Color(*
this, UndeserializedColor);
784 OS <<
"<undeserialized declarations>";
789 void ASTDumper::dumpLookups(
const DeclContext *DC,
bool DumpDecls) {
791 OS <<
"StoredDeclsMap ";
792 dumpBareDeclRef(cast<Decl>(DC));
797 dumpPointer(cast<Decl>(Primary));
811 OS <<
"DeclarationName ";
813 ColorScope Color(*
this, DeclNameColor);
814 OS <<
'\'' << Name <<
'\'';
820 dumpBareDeclRef(*RI);
822 if ((*RI)->isHidden())
828 std::function<void(Decl *)> DumpWithPrev = [&](
Decl *D) {
840 if (HasUndeserializedLookups) {
842 ColorScope Color(*
this, UndeserializedColor);
843 OS <<
"<undeserialized lookups>";
849 void ASTDumper::dumpAttr(
const Attr *A) {
852 ColorScope Color(*
this, AttrColor);
855 #define ATTR(X) case attr::X: OS << #X; break;
856 #include "clang/Basic/AttrList.inc"
866 #include "clang/AST/AttrDump.inc"
876 OS <<
" first " << First;
883 OS <<
" prev " << Prev;
890 #define DECL(DERIVED, BASE) \
891 case Decl::DERIVED: \
892 return dumpPreviousDeclImpl(OS, cast<DERIVED##Decl>(D));
893 #define ABSTRACT_DECL(DECL)
894 #include "clang/AST/DeclNodes.inc"
896 llvm_unreachable(
"Decl that isn't part of DeclNodes.inc!");
921 OS <<
"CXXCtorInitializer";
930 llvm_unreachable(
"Unknown initializer type");
945 void ASTDumper::dumpTemplateArgumentListInfo(
947 for (
unsigned i = 0, e = TALI.
size(); i < e; ++i)
948 dumpTemplateArgumentLoc(TALI[i]);
956 for (
unsigned i = 0, e = TAL.
size(); i < e; ++i)
957 dumpTemplateArgument(TAL[i]);
962 OS <<
"TemplateArgument";
989 OS <<
" template expansion";
1000 dumpTemplateArgument(*
I);
1013 for (
auto typeParam : *typeParams) {
1014 dumpDecl(typeParam);
1022 void ASTDumper::dumpDecl(
const Decl *D) {
1025 ColorScope Color(*
this, NullColor);
1031 ColorScope Color(*
this, DeclKindNameColor);
1044 OS <<
" in " << M->getFullModuleName();
1045 if (
auto *ND = dyn_cast<NamedDecl>(D))
1047 const_cast<NamedDecl *>(ND)))
1048 dumpChild([=] { OS <<
"also in " << M->getFullModuleName(); });
1049 if (
const NamedDecl *ND = dyn_cast<NamedDecl>(D))
1057 OS <<
" referenced";
1060 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
1061 if (FD->isConstexpr())
1076 if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D) &&
1077 hasNodes(dyn_cast<DeclContext>(D)))
1078 dumpDeclContext(cast<DeclContext>(D));
1082 void ASTDumper::VisitLabelDecl(
const LabelDecl *D) {
1086 void ASTDumper::VisitTypedefDecl(
const TypedefDecl *D) {
1090 OS <<
" __module_private__";
1094 void ASTDumper::VisitEnumDecl(
const EnumDecl *D) {
1103 OS <<
" __module_private__";
1108 void ASTDumper::VisitRecordDecl(
const RecordDecl *D) {
1112 OS <<
" __module_private__";
1114 OS <<
" definition";
1128 for (
auto *Child : D->
chain())
1132 void ASTDumper::VisitFunctionDecl(
const FunctionDecl *D) {
1144 OS <<
" __module_private__";
1173 dumpTemplateArgumentList(*FTSI->TemplateArguments);
1176 dumpChild([=] { OS <<
"<<NULL params x " << D->
getNumParams() <<
">>"; });
1179 dumpDecl(Parameter);
1185 dumpCXXCtorInitializer(*
I);
1188 if (MD->size_overridden_methods() != 0) {
1192 OS << D <<
" " << D->
getParent()->getName() <<
"::"
1197 auto FirstOverrideItr = MD->begin_overridden_methods();
1198 OS <<
"Overrides: [ ";
1199 dumpOverride(*FirstOverrideItr);
1200 for (
const auto *Override :
1201 llvm::make_range(FirstOverrideItr + 1,
1202 MD->end_overridden_methods()))
1203 dumpOverride(Override);
1212 void ASTDumper::VisitFieldDecl(
const FieldDecl *D) {
1218 OS <<
" __module_private__";
1226 void ASTDumper::VisitVarDecl(
const VarDecl *D) {
1238 OS <<
" __module_private__";
1261 void ASTDumper::VisitBindingDecl(
const BindingDecl *D) {
1272 void ASTDumper::VisitImportDecl(
const ImportDecl *D) {
1279 case PCK_Unknown: llvm_unreachable(
"unexpected pragma comment kind");
1282 case PCK_Lib: OS <<
"lib";
break;
1284 case PCK_User: OS <<
"user";
break;
1286 StringRef Arg = D->
getArg();
1288 OS <<
" \"" << Arg <<
"\"";
1291 void ASTDumper::VisitPragmaDetectMismatchDecl(
1296 void ASTDumper::VisitCapturedDecl(
const CapturedDecl *D) {
1315 OS <<
" initializer";
1316 dumpStmt(Initializer);
1330 void ASTDumper::VisitNamespaceDecl(
const NamespaceDecl *D) {
1348 void ASTDumper::VisitTypeAliasDecl(
const TypeAliasDecl *D) {
1360 void ASTDumper::VisitCXXRecordDecl(
const CXXRecordDecl *D) {
1365 for (
const auto &
I : D->
bases()) {
1369 dumpAccessSpecifier(
I.getAccessSpecifier());
1370 dumpType(
I.getType());
1371 if (
I.isPackExpansion())
1382 template<
typename SpecializationDecl>
1383 void ASTDumper::VisitTemplateDeclSpecialization(
const SpecializationDecl *D,
1384 bool DumpExplicitInst,
1386 bool DumpedAny =
false;
1387 for (
auto *RedeclWithBadType : D->redecls()) {
1391 auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
1395 assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
1396 "expected an injected-class-name");
1400 switch (Redecl->getTemplateSpecializationKind()) {
1403 if (!DumpExplicitInst)
1409 dumpDeclRef(Redecl);
1424 template<
typename TemplateDecl>
1425 void ASTDumper::VisitTemplateDecl(
const TemplateDecl *D,
1426 bool DumpExplicitInst) {
1432 for (
auto *Child : D->specializations())
1433 VisitTemplateDeclSpecialization(Child, DumpExplicitInst,
1441 VisitTemplateDecl(D,
true);
1445 VisitTemplateDecl(D,
false);
1448 void ASTDumper::VisitClassTemplateSpecializationDecl(
1450 VisitCXXRecordDecl(D);
1454 void ASTDumper::VisitClassTemplatePartialSpecializationDecl(
1456 VisitClassTemplateSpecializationDecl(D);
1460 void ASTDumper::VisitClassScopeFunctionSpecializationDecl(
1468 VisitTemplateDecl(D,
false);
1476 void ASTDumper::VisitVarTemplateSpecializationDecl(
1482 void ASTDumper::VisitVarTemplatePartialSpecializationDecl(
1485 VisitVarTemplateSpecializationDecl(D);
1511 void ASTDumper::VisitTemplateTemplateParmDecl(
1522 void ASTDumper::VisitUsingDecl(
const UsingDecl *D) {
1529 void ASTDumper::VisitUnresolvedUsingTypenameDecl(
1549 dumpTypeAsChild(TD->getTypeForDecl());
1552 void ASTDumper::VisitConstructorUsingShadowDecl(
1570 OS <<
"constructed ";
1589 void ASTDumper::VisitFriendDecl(
const FriendDecl *D) {
1591 dumpType(T->getType());
1600 void ASTDumper::VisitObjCIvarDecl(
const ObjCIvarDecl *D) {
1604 OS <<
" synthesize";
1637 dumpDecl(Parameter);
1641 dumpChild([=] { OS <<
"..."; });
1658 OS <<
" contravariant";
1708 dumpCXXCtorInitializer(*
I);
1746 OS <<
" unsafe_unretained";
1759 OS <<
" synthesize";
1766 void ASTDumper::VisitBlockDecl(
const BlockDecl *D) {
1771 dumpChild([=]{ OS <<
"..."; });
1774 dumpChild([=]{ OS <<
"capture this"; });
1783 if (
I.getVariable()) {
1785 dumpBareDeclRef(
I.getVariable());
1787 if (
I.hasCopyExpr())
1788 dumpStmt(
I.getCopyExpr());
1798 void ASTDumper::dumpStmt(
const Stmt *
S) {
1801 ColorScope Color(*
this, NullColor);
1806 if (
const DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
1818 void ASTDumper::VisitStmt(
const Stmt *
Node) {
1820 ColorScope Color(*
this, StmtColor);
1827 void ASTDumper::VisitDeclStmt(
const DeclStmt *Node) {
1835 void ASTDumper::VisitAttributedStmt(
const AttributedStmt *Node) {
1843 void ASTDumper::VisitLabelStmt(
const LabelStmt *Node) {
1845 OS <<
" '" << Node->
getName() <<
"'";
1848 void ASTDumper::VisitGotoStmt(
const GotoStmt *Node) {
1854 void ASTDumper::VisitCXXCatchStmt(
const CXXCatchStmt *Node) {
1859 void ASTDumper::VisitCapturedStmt(
const CapturedStmt *Node) {
1868 void ASTDumper::VisitOMPExecutableDirective(
1871 for (
auto *C : Node->
clauses()) {
1874 ColorScope Color(*
this, NullColor);
1875 OS <<
"<<<NULL>>> OMPClause";
1879 ColorScope Color(*
this, AttrColor);
1881 OS <<
"OMP" << ClauseName.substr(0, 1).upper()
1882 << ClauseName.drop_front() <<
"Clause";
1885 dumpSourceRange(
SourceRange(
C->getLocStart(),
C->getLocEnd()));
1886 if (
C->isImplicit())
1887 OS <<
" <implicit>";
1888 for (
auto *S :
C->children())
1898 void ASTDumper::VisitExpr(
const Expr *Node) {
1903 ColorScope Color(*
this, ValueKindColor);
1917 ColorScope Color(*
this, ObjectKindColor);
1925 OS <<
" objcproperty";
1928 OS <<
" objcsubscript";
1931 OS <<
" vectorcomponent";
1962 void ASTDumper::VisitCastExpr(
const CastExpr *Node) {
1966 ColorScope Color(*
this, CastColor);
1973 void ASTDumper::VisitDeclRefExpr(
const DeclRefExpr *Node) {
1977 dumpBareDeclRef(Node->
getDecl());
1990 OS <<
"ADL) = '" << Node->
getName() <<
'\'';
2004 ColorScope Color(*
this, DeclKindNameColor);
2007 OS <<
"='" << *Node->
getDecl() <<
"'";
2010 OS <<
" isFreeIvar";
2013 void ASTDumper::VisitPredefinedExpr(
const PredefinedExpr *Node) {
2020 ColorScope Color(*
this, ValueColor);
2024 void ASTDumper::VisitIntegerLiteral(
const IntegerLiteral *Node) {
2028 ColorScope Color(*
this, ValueColor);
2029 OS <<
" " << Node->
getValue().toString(10, isSigned);
2034 ColorScope Color(*
this, ValueColor);
2038 void ASTDumper::VisitStringLiteral(
const StringLiteral *Str) {
2040 ColorScope Color(*
this, ValueColor);
2045 void ASTDumper::VisitInitListExpr(
const InitListExpr *ILE) {
2049 OS <<
"array filler";
2055 dumpBareDeclRef(Field);
2067 void ASTDumper::VisitUnaryOperator(
const UnaryOperator *Node) {
2069 OS <<
" " << (Node->
isPostfix() ?
"postfix" :
"prefix")
2073 void ASTDumper::VisitUnaryExprOrTypeTraitExpr(
2087 OS <<
" __builtin_omp_required_simd_align";
2094 void ASTDumper::VisitMemberExpr(
const MemberExpr *Node) {
2105 void ASTDumper::VisitBinaryOperator(
const BinaryOperator *Node) {
2110 void ASTDumper::VisitCompoundAssignOperator(
2114 <<
"' ComputeLHSTy=";
2116 OS <<
" ComputeResultTy=";
2120 void ASTDumper::VisitBlockExpr(
const BlockExpr *Node) {
2134 void ASTDumper::VisitAddrLabelExpr(
const AddrLabelExpr *Node) {
2155 OS <<
" " << (Node->
getValue() ?
"true" :
"false");
2158 void ASTDumper::VisitCXXThisExpr(
const CXXThisExpr *Node) {
2185 void ASTDumper::VisitCXXNewExpr(
const CXXNewExpr *Node) {
2199 void ASTDumper::VisitCXXDeleteExpr(
const CXXDeleteExpr *Node) {
2215 OS <<
" extended by ";
2216 dumpBareDeclRef(VD);
2222 for (
unsigned i = 0, e = Node->
getNumObjects(); i != e; ++i)
2223 dumpDeclRef(Node->
getObject(i),
"cleanup");
2226 void ASTDumper::dumpCXXTemporary(
const CXXTemporary *Temporary) {
2227 OS <<
"(CXXTemporary";
2228 dumpPointer(Temporary);
2232 void ASTDumper::VisitSizeOfPackExpr(
const SizeOfPackExpr *Node) {
2238 dumpTemplateArgument(A);
2241 void ASTDumper::VisitCXXDependentScopeMemberExpr(
2265 OS <<
" super (instance)";
2269 OS <<
" super (class)";
2274 void ASTDumper::VisitObjCBoxedExpr(
const ObjCBoxedExpr *Node) {
2278 BoxingMethod->getSelector().print(OS);
2285 dumpDecl(CatchParam);
2290 void ASTDumper::VisitObjCEncodeExpr(
const ObjCEncodeExpr *Node) {
2311 OS <<
" Kind=MethodRef Getter=\"";
2317 OS <<
"\" Setter=\"";
2319 Setter->getSelector().print(OS);
2330 OS <<
" Messaging=";
2332 OS <<
"Getter&Setter";
2342 OS <<
" Kind=ArraySubscript GetterForArray=\"";
2344 OS <<
" Kind=DictionarySubscript GetterForDictionary=\"";
2351 OS <<
"\" SetterForArray=\"";
2353 OS <<
"\" SetterForDictionary=\"";
2362 OS <<
" " << (Node->
getValue() ?
"__objc_yes" :
"__objc_no");
2369 const char *ASTDumper::getCommandName(
unsigned CommandID) {
2371 return Traits->getCommandInfo(CommandID)->Name;
2375 return "<not a builtin command>";
2378 void ASTDumper::dumpFullComment(
const FullComment *C) {
2387 void ASTDumper::dumpComment(
const Comment *C) {
2390 ColorScope Color(*
this, NullColor);
2396 ColorScope Color(*
this, CommentColor);
2408 void ASTDumper::visitTextComment(
const TextComment *C) {
2409 OS <<
" Text=\"" << C->
getText() <<
"\"";
2413 OS <<
" Name=\"" << getCommandName(C->
getCommandID()) <<
"\"";
2416 OS <<
" RenderNormal";
2419 OS <<
" RenderBold";
2422 OS <<
" RenderMonospaced";
2425 OS <<
" RenderEmphasized";
2429 for (
unsigned i = 0, e = C->
getNumArgs(); i != e; ++i)
2430 OS <<
" Arg[" << i <<
"]=\"" << C->
getArgText(i) <<
"\"";
2437 for (
unsigned i = 0, e = C->
getNumAttrs(); i != e; ++i) {
2439 OS <<
" \"" << Attr.
Name <<
"=\"" << Attr.
Value <<
"\"";
2443 OS <<
" SelfClosing";
2451 OS <<
" Name=\"" << getCommandName(C->
getCommandID()) <<
"\"";
2452 for (
unsigned i = 0, e = C->
getNumArgs(); i != e; ++i)
2453 OS <<
" Arg[" << i <<
"]=\"" << C->
getArgText(i) <<
"\"";
2460 OS <<
" explicitly";
2462 OS <<
" implicitly";
2484 OS <<
" Position=<";
2485 for (
unsigned i = 0, e = C->
getDepth(); i != e; ++i) {
2495 OS <<
" Name=\"" << getCommandName(C->
getCommandID()) <<
"\""
2499 void ASTDumper::visitVerbatimBlockLineComment(
2501 OS <<
" Text=\"" << C->
getText() <<
"\"";
2505 OS <<
" Text=\"" << C->
getText() <<
"\"";
2514 llvm::errs() << msg <<
": ";
2521 ASTDumper Dumper(OS,
nullptr,
nullptr);
2522 Dumper.dumpTypeAsChild(*
this);
2537 LLVM_DUMP_METHOD
void Decl::dump(raw_ostream &OS,
bool Deserialize)
const {
2538 ASTDumper
P(OS, &getASTContext().getCommentCommandTraits(),
2539 &getASTContext().getSourceManager());
2540 P.setDeserialize(Deserialize);
2545 ASTDumper
P(llvm::errs(), &getASTContext().getCommentCommandTraits(),
2546 &getASTContext().getSourceManager(),
true);
2551 dumpLookups(llvm::errs());
2556 bool Deserialize)
const {
2560 ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
2562 P.setDeserialize(Deserialize);
2563 P.dumpLookups(
this, DumpDecls);
2571 dump(llvm::errs(), SM);
2575 ASTDumper
P(OS,
nullptr, &SM);
2580 ASTDumper
P(OS,
nullptr,
nullptr);
2585 ASTDumper
P(llvm::errs(),
nullptr,
nullptr);
2590 ASTDumper
P(llvm::errs(),
nullptr,
nullptr,
true);
2599 dump(llvm::errs(),
nullptr,
nullptr);
2610 ASTDumper D(OS, Traits, SM);
2611 D.dumpFullComment(FC);
2616 ASTDumper D(llvm::errs(),
nullptr,
nullptr,
true);
2617 D.dumpFullComment(FC);
decl_iterator noload_decls_end() const
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
unsigned getNumElements() const
The receiver is the instance of the superclass object.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Defines the clang::ASTContext interface.
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
SourceLocation getEnd() const
Expr * getSizeExpr() const
const Type * Ty
The locally-unqualified type.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
The receiver is an object instance.
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
unsigned getDepth() const
protocol_range protocols() const
PointerType - C99 6.7.5.1 - Pointer Declarators.
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
A (possibly-)qualified type.
ArrayRef< Capture > captures() const
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
SourceRange getBracketsRange() const
unsigned getColumn() const
Return the presumed column number of this location.
ArrayRef< OMPClause * > clauses()
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
ObjCInterfaceDecl * getClassInterface()
bool isBitField() const
Determines whether this field is a bitfield.
QualType getType() const
Retrieves the type of the base class.
bool isElidable() const
Whether this construction is elidable.
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
PropertyControl getPropertyImplementation() const
CXXMethodDecl * getSpecialization() const
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID. ...
Stmt - This represents one statement.
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
bool isParameterPack() const
Returns whether this is a parameter pack.
FunctionType - C99 6.7.5.3 - Function Declarators.
bool isInvalid() const
Return true if this object is invalid or uninitialized.
const Expr * getInitExpr() const
bool isArgumentType() const
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
bool isGlobalDelete() const
bool isMessagingGetter() const
True if the property reference will result in a message to the getter.
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
Defines the SourceManager interface.
The template argument is an expression, and we've not resolved it to one of the other forms yet...
CXXRecordDecl * getDecl() const
QualType getUnderlyingType() const
CXXCtorInitializer *const * init_const_iterator
init_const_iterator - Iterates through the ivar initializer list.
Defines the clang::Module class, which describes a module in the source code.
Decl - This represents one declaration (or definition), e.g.
ObjCMethodDecl * getAtIndexMethodDecl() const
void dumpColor() const
dumpColor - same as dump(), but forces color highlighting.
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Represents a C++11 auto or C++14 decltype(auto) type.
Represents an attribute applied to a statement.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
std::string getAsString() const
bool isHidden() const
Determine whether this declaration might be hidden from name lookup.
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
const char * getCastKindName() const
QualType getPointeeType() const
The base class of the type hierarchy.
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
Declaration of a variable template.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
const Expr * getInit() const
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
NamespaceDecl - Represent a C++ namespace.
Represents a call to a C++ constructor.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
RetTy Visit(const Type *T)
Performs the operation associated with this visitor object.
bool isDecltypeAuto() const
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
bool isMessagingSetter() const
True if the property reference will result in a message to the setter.
A container of type source information.
unsigned getIndex() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Expr * getBinding() const
Get the expression to which this declaration is bound.
Represents a C++ constructor within a class.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
bool isSpelledAsLValue() const
Expr * getInClassInitializer() const
getInClassInitializer - Get the C++11 in-class initializer for this member, or null if one has not be...
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
IdentType getIdentType() const
const llvm::APInt & getSize() const
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
void * getAsOpaquePtr() const
bool hasExplicitTemplateArgs() const
const CXXBaseSpecifier *const * path_const_iterator
const TemplateArgumentListInfo & templateArgs() const
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
An Objective-C array/dictionary subscripting which reads an object or writes at the subscripted array...
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Expr * getInit() const
Get the initializer.
bool capturesCXXThis() const
TLSKind getTLSKind() const
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
Represents an empty template argument, e.g., one that has not been deduced.
Extra information about a function prototype.
AccessSpecifier getAccess() const
std::string getAsString() const
Represents a variable template specialization, which refers to a variable template with a given set o...
ObjCMethodDecl - Represents an instance or class method declaration.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
TemplateTypeParmDecl * getDecl() const
QualType getOriginalType() const
UnaryExprOrTypeTrait getKind() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
decl_iterator decls_end() const
Qualifiers getIndexTypeQualifiers() const
unsigned getValue() const
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
ParmVarDecl - Represents a parameter to a function.
Represents the result of substituting a type for a template type parameter.
void dump(const char *s) const
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
LabelStmt - Represents a label, which has a substatement.
Kind getPropertyImplementation() const
RecordDecl - Represents a struct/union/class.
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class. ...
ConstructorUsingShadowDecl * getConstructedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the base class for which we don't have an explicit ini...
const char * getOpenMPClauseName(OpenMPClauseKind Kind)
Provides common interface for the Decls that can be redeclared.
QualType getElementType() const
Represents a class template specialization, which refers to a class template with a given set of temp...
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
ObjCProtocolDecl * getProtocol() const
comments::CommandTraits & getCommentCommandTraits() const
StringLiteral * getMessage()
A vector component is an element or range of elements on a vector.
Expr * getSizeExpr() const
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
The results of name lookup within a DeclContext.
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
ArrayRef< QualType > getParamTypes() const
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
protocol_iterator protocol_begin() const
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
all_lookups_iterator lookups_end() const
bool isPure() const
Whether this virtual function is pure, i.e.
bool isTranslationUnit() const
unsigned size() const
Retrieve the number of template arguments in this template argument list.
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
std::string getFullModuleName(bool AllowStringLiterals=false) const
Retrieve the full name of this module, including the path from its top-level module.
Represents the result of substituting a set of types for a template type parameter pack...
IdentifierInfo & getAccessor() const
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
Represents an access specifier followed by colon ':'.
unsigned getRegParm() const
Declaration of a function specialization at template class scope.
SourceRange getSourceRange() const LLVM_READONLY
Fetches the full source range of the argument.
Describes a module or submodule.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Expr * getUnderlyingExpr() const
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
const VarDecl * getCatchParamDecl() const
Represents Objective-C's @catch statement.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Describes an C or C++ initializer list.
Represents a C++ using-declaration.
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
bool isThisDeclarationADefinition() const
Returns whether this specific method is a definition.
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
TemplateArgument getArgumentPack() const
ConstructorUsingShadowDecl * getNominatedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the direct base class from which this using shadow dec...
ObjCMethodDecl * getBoxingMethod() const
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
An lvalue ref-qualifier was provided (&).
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
bool isInline() const
Returns true if this is an inline namespace declaration.
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
A convenient class for passing around template argument information.
const ValueDecl * getExtendingDecl() const
Get the declaration which triggered the lifetime-extension of this temporary, if any.
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
NamedDecl * getAliasedNamespace() const
Retrieve the namespace that this alias refers to, which may either be a NamespaceDecl or a NamespaceA...
protocol_iterator protocol_end() const
QualType getReturnType() const
bool isSuperReceiver() const
UnresolvedUsingTypenameDecl * getDecl() const
bool isDefaulted() const
Whether this function is defaulted per C++0x.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
An x-value expression is a reference to an object with independent storage but which can be "moved"...
path_iterator path_begin()
Represents a typeof (or typeof) expression (a GCC extension).
A builtin binary operation expression such as "x + y" or "x <= y".
Selector getSelector() const
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
std::string getNameAsString() const
getNameAsString - Get a human-readable name for the declaration, even if it is one of the special kin...
QualType getDefaultArgument() const
Retrieve the default argument, if any.
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Represents an Objective-C protocol declaration.
Represents binding an expression to a temporary.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
CXXTemporary * getTemporary()
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
unsigned getLine() const
Return the presumed line number of this location.
ArrayRef< BindingDecl * > bindings() const
An ordinary object is located at an address in memory.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
This represents the body of a CapturedStmt, and serves as its DeclContext.
Represents an ObjC class declaration.
CleanupObject getObject(unsigned i) const
Represents a linkage specification.
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
decl_iterator decls_begin() const
ObjCMethodDecl * setAtIndexMethodDecl() const
detail::InMemoryDirectory::const_iterator I
is ARM Neon polynomial vector
PropertyAttributeKind getPropertyAttributes() const
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
A binding in a decomposition declaration.
bool isFromAST() const
Whether this type comes from an AST file.
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
Represents an extended vector type where either the type or size is dependent.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
param_iterator param_begin()
static void dumpPreviousDeclImpl(raw_ostream &OS,...)
Represents the this expression in C++.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
FunctionDecl * getOperatorDelete() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
ExtInfo getExtInfo() const
llvm::APInt getValue() const
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
ArrayRef< Module * > getModulesWithMergedDefinition(const NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
Represents a prototype with parameter type info, e.g.
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
unsigned getNumObjects() const
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
decl_range noload_decls() const
noload_decls_begin/end - Iterate over the declarations stored in this context that are currently load...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
SourceRange getRange() const
StorageClass getStorageClass() const
Returns the storage class as written in the source.
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
Represents an array type in C++ whose size is a value-dependent expression.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool isDeleted() const
Whether this function has been deleted.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
QualType getPointeeType() const
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
void outputString(raw_ostream &OS) const
static void dumpBasePath(raw_ostream &OS, const CastExpr *Node)
bool isDeletedAsWritten() const
decls_iterator decls_end() const
Declaration of a template type parameter.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
ObjCIvarDecl * getPropertyIvarDecl() const
double getValueAsApproximateDouble() const
getValueAsApproximateDouble - This returns the value as an inaccurate double.
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
Expr * getBitWidth() const
ArrayRef< NamedDecl * > chain() const
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
Expr * getUnderlyingExpr() const
ObjCMethodDecl * getImplicitPropertyGetter() const
ArgKind getKind() const
Return the kind of stored template argument.
ExtProtoInfo getExtProtoInfo() const
DeclContext * getDeclContext()
ObjCSelectorExpr used for @selector in Objective-C.
const char * getDeclKindName() const
Represents an expression that computes the length of a parameter pack.
CXXRecordDecl * getConstructedBaseClass() const
Get the base class whose constructor or constructor shadow declaration is passed the constructor argu...
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
Represents the type decltype(expr) (C++11).
Selector getSelector() const
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
SourceLocation getAttributeLoc() const
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
StorageClass
Storage classes.
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isInstanceMethod() const
Direct list-initialization (C++11)
Qualifiers Quals
The local qualifiers.
Declaration of an alias template.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
An expression that sends a message to the given Objective-C object or class.
Represents an unpacked "presumed" location which can be presented to the user.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
ArrayRef< ParmVarDecl * > parameters() const
Represents a GCC generic vector type.
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
QualType getElementType() const
QualType getComputationLHSType() const
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
This template specialization was implicitly instantiated from a template.
all_lookups_iterator lookups_begin() const
Iterators over all possible lookups within this context.
UnresolvedSetImpl::iterator decls_iterator
const clang::PrintingPolicy & getPrintingPolicy() const
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
ObjCCategoryDecl * getCategoryDecl() const
SourceRange getBracketsRange() const
QualType getComputationResultType() const
LabelDecl * getLabel() const
decls_iterator decls_begin() const
ArrayRef< ParmVarDecl * > parameters() const
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
Stmt * getBody(const FunctionDecl *&Definition) const
getBody - Retrieve the body (definition) of the function.
bool doesThisDeclarationHaveABody() const
doesThisDeclarationHaveABody - Returns whether this specific declaration of the function has a body -...
StringRef getValue() const
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
is AltiVec 'vector Pixel'
This captures a statement into a function.
not a target-specific vector type
ExceptionSpecificationType Type
The kind of exception specification this is.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
const char * getFilename() const
Return the presumed filename of this location.
Encodes a location in the source.
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
unsigned getNumParams() const
getNumParams - Return the number of parameters this function must have based on its FunctionType...
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
This represents '#pragma omp declare reduction ...' directive.
QualType getElementType() const
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Pseudo declaration for capturing expressions.
Represents a C++ temporary.
Interfaces are the core concept in Objective-C for object oriented design.
const ObjCInterfaceDecl * getClassInterface() const
FieldDecl * getAnyMember() const
This is a basic class for representing single OpenMP executable directive.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
ASTContext & getASTContext() const LLVM_READONLY
decl_iterator noload_decls_begin() const
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
LabelDecl - Represents the declaration of a label.
VectorKind getVectorKind() const
Represents a dependent using declaration which was not marked with typename.
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
bool getSynthesize() const
Represents a static or instance method of a struct/union/class.
unsigned getDepth() const
Retrieve the depth of the template parameter.
No ref-qualifier was provided.
C-style initialization with assignment.
ArrayRef< ParmVarDecl * > parameters() const
all_lookups_iterator noload_lookups_end() const
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
This file defines OpenMP nodes for declarative directives.
all_lookups_iterator noload_lookups_begin() const
Iterators over all possible lookups within this context that are currently loaded; don't attempt to r...
ObjCCategoryDecl - Represents a category declaration.
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
const ObjCInterfaceDecl * getClassInterface() const
NamedDecl * getPack() const
Retrieve the parameter pack.
decl_iterator decl_begin()
ObjCProtocolExpr used for protocol expression in Objective-C.
SplitQualType getSplitDesugaredType() const
is AltiVec 'vector bool ...'
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Represents one property declaration in an Objective-C interface.
TypedefNameDecl * getDecl() const
QualType getReturnType() const
SourceLocation getBegin() const
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
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 (&&).
ObjCBoxedExpr - used for generalized expression boxing.
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
const BlockDecl * getBlockDecl() const
QualType getType() const
Return the type wrapped by this type source info.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
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...
The injected class name of a C++ class template or class template partial specialization.
QualType getPointeeType() const
Represents a pack expansion of types.
CompoundAssignOperator - For compound assignments (e.g.
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof...
static const char * getStorageClassSpecifierString(StorageClass SC)
getStorageClassSpecifierString - Return the string used to specify the storage class SC...
const char * getCastName() const
getCastName - Get the name of the C++ cast being used, e.g., "static_cast", "dynamic_cast", "reinterpret_cast", or "const_cast".
const char * getTypeClassName() const
Expr * getSizeExpr() const
AddrLabelExpr - The GNU address of label extension, representing &&label.
attr::Kind getKind() const
ast_type_traits::DynTypedNode Node
TLS with a dynamic initializer.
Represents a template argument.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
QualType getAsType() const
Retrieve the type for a type template argument.
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
Print this nested name specifier to the given output stream.
bool isImplicitProperty() const
StringRef getOpcodeStr() const
ObjCCategoryImplDecl * getImplementation() const
not evaluated yet, for special member function
[C99 6.4.2.2] - A predefined identifier such as func.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
The base class of all kinds of template declarations (e.g., class, function, etc.).
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
The template argument is a pack expansion of a template name that was provided for a template templat...
bool isInvalidDecl() const
bool isImplicit() const
Returns true if the attribute has been implicitly created instead of explicitly written by the user...
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
A decomposition declaration.
This template specialization was instantiated from a template due to an explicit instantiation declar...
bool isParameterPack() const
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Represents a dependent using declaration which was marked with typename.
DeclarationName - The name of a declaration.
Represents the declaration of an Objective-C type parameter.
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
Selector getSelector() const
EnumDecl - Represents an enum.
detail::InMemoryDirectory::const_iterator E
A pointer to member type per C++ 8.3.3 - Pointers to members.
QualType getModifiedType() const
attr_iterator attr_end() const
unsigned getDepth() const
Get the nesting depth of the template parameter.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
Represents a pointer to an Objective C object.
StringRef getName() const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
ObjCMethodDecl * getGetterMethodDecl() const
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
Location wrapper for a TemplateArgument.
FunctionDecl * getOperatorNew() const
const T * getAs() const
Member-template getAs<specific type>'.
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
Represents a C++ base or member initializer.
static StringRef getIdentTypeName(IdentType IT)
This template specialization was declared or defined by an explicit specialization (C++ [temp...
void dump(raw_ostream &OS) const
Debugging aid that dumps the template name.
ObjCMethodDecl * getSetterMethodDecl() const
ObjCEncodeExpr, used for @encode in Objective-C.
ObjCProtocolList::iterator protocol_iterator
Module * getOwningModule() const
Get the module that owns this declaration.
QualType getIntegerType() const
getIntegerType - Return the integer type this enum decl corresponds to.
bool hasBody() const override
Determine whether this method has a body.
DeclGroupRef::const_iterator const_decl_iterator
Base for LValueReferenceType and RValueReferenceType.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
The template argument is a type.
protocol_range protocols() const
ObjCImplementationDecl * getImplementation() const
The template argument is actually a parameter pack.
LabelDecl * getLabel() const
Represents a base class of a C++ class.
ObjCPropertyDecl * getExplicitProperty() const
A bitfield object is a bitfield on a C or C++ record.
bool isAnyMemberInitializer() const
QualType getPointeeType() const
ObjCIvarRefExpr - A reference to an ObjC instance variable.
SourceManager & getSourceManager()
GotoStmt - This represents a direct goto.
ArrayRef< const Attr * > getAttrs() const
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
A template argument list.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
const Type * getClass() const
ObjCPropertyDecl * getPropertyDecl() const
AccessControl getAccessControl() const
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
An attributed type is a type to which a type attribute has been applied.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Call-style initialization (C++98)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Represents a C++ struct/union/class.
bool hasQualifiers() const
Return true if the set contains any qualifiers.
Represents a loop initializing the elements of an array.
The template argument is a template name that was provided for a template template parameter...
QualType getEncodedType() const
CXXCatchStmt - This represents a C++ catch block.
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
ObjCIvarDecl - Represents an ObjC instance variable.
ArraySizeModifier getSizeModifier() const
bool isInline() const
Whether this variable is (C++1z) inline.
Declaration of a class template.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
static void dumpPreviousDecl(raw_ostream &OS, const Decl *D)
Dump the previous declaration in the redeclaration chain for a declaration, if any.
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
pack_iterator pack_end() const
Iterator referencing one past the last argument of a template argument pack.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
unsigned getIndex() const
Retrieve the index of the template parameter.
StringLiteral - This represents a string literal expression, e.g.
DeclarationName getName() const
Gets the name looked up.
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
TLS with a known-constant initializer.
ObjCInterfaceDecl * getSuperClass() const
TagDecl * getDecl() const
Abstract class common to all of the C++ "named"/"keyword" casts.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
VarDecl * getExceptionDecl() const
A reference to a declared variable, function, enum, etc.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool constructsVirtualBase() const
Returns true if the constructed base class is a virtual base class subobject of this declaration's cl...
Represents a type template specialization; the template must be a class template, a type alias templa...
QualType getElementType() const
QualType getElementType() const
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
bool isArraySubscriptRefExpr() const
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
attr_iterator attr_begin() const
static StringRef getNameForCallConv(CallingConv CC)
An l-value expression is a reference to an object with independent storage.
StringRef getKindName() const
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to...
NamedDecl - This represents a decl with a name.
A boolean literal, per ([C++ lex.bool] Boolean literals).
Represents a C array with a specified size that is not an integer-constant-expression.
Represents a C++ namespace alias.
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
Represents C++ using-directive.
Represents a #pragma detect_mismatch line.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
The receiver is a superclass.
const char * getStmtClassName() const
const char * getName() const
A simple visitor class that helps create declaration visitors.
const TemplateArgument & getArgument() const
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
This represents '#pragma omp threadprivate ...' directive.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined...
Represents the canonical version of C arrays with a specified constant size.
This class handles loading and caching of source files into memory.
The parameter is invariant: must match exactly.
ExceptionSpecInfo ExceptionSpec
Defines enum values for all the target-independent builtin functions.
Declaration of a template function.
AttrVec::const_iterator attr_iterator
ObjCMethodDecl * getImplicitPropertySetter() const
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
Attr - This represents one attribute.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
ObjCCompatibleAliasDecl - Represents alias of a class.
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
bool hasExternalVisibleStorage() const
Whether this DeclContext has external storage containing additional declarations that are visible in ...
const ObjCInterfaceDecl * getSuperClass() const
const StringLiteral * getAsmString() const
QualType getArgumentType() const
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.