29 #include "llvm/Support/raw_ostream.h" 30 using namespace clang;
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 };
110 bool Deserialize =
false;
113 bool TopLevel =
true;
116 bool FirstChild =
true;
123 const char *LastLocFilename =
"";
124 unsigned LastLocLine = ~0U;
132 template<
typename Fn>
void dumpChild(Fn doDumpChild) {
138 while (!Pending.empty()) {
139 Pending.back()(
true);
149 auto dumpWithIndent = [
this, doDumpChild, OrigFC](
bool isLastChild) {
164 ColorScope Color(*
this, IndentColor);
165 OS << Prefix << (isLastChild ?
'`' :
'|') <<
'-';
166 this->Prefix.push_back(isLastChild ?
' ' :
'|');
167 this->Prefix.push_back(
' ');
171 unsigned Depth = Pending.size();
178 while (Depth < Pending.size()) {
179 Pending.back()(
true);
180 this->Pending.pop_back();
184 this->Prefix.resize(Prefix.size() - 2);
188 Pending.push_back(std::move(dumpWithIndent));
190 Pending.back()(
false);
191 Pending.back() = std::move(dumpWithIndent);
199 ColorScope(ASTDumper &Dumper, TerminalColor Color)
201 if (Dumper.ShowColors)
202 Dumper.OS.changeColor(Color.Color, Color.Bold);
205 if (Dumper.ShowColors)
206 Dumper.OS.resetColor();
213 : ASTDumper(OS, Traits, SM,
214 SM && SM->getDiagnostics().getShowColors()) {}
218 : ASTDumper(OS, Traits, SM, ShowColors,
LangOptions()) {}
222 : OS(OS), Traits(Traits), SM(SM), PrintPolicy(PrintPolicy),
223 ShowColors(ShowColors) {}
225 void setDeserialize(
bool D) { Deserialize = D; }
227 void dumpDecl(
const Decl *D);
228 void dumpStmt(
const Stmt *S);
232 void dumpPointer(
const void *Ptr);
238 void dumpTypeAsChild(
const Type *
T);
239 void dumpBareDeclRef(
const Decl *
Node);
240 void dumpDeclRef(
const Decl *
Node,
const char *
Label =
nullptr);
244 void dumpLookups(
const DeclContext *DC,
bool DumpDecls);
245 void dumpAttr(
const Attr *A);
275 OS <<
" written as lvalue reference";
276 VisitReferenceType(T);
282 void VisitArrayType(
const ArrayType *T) {
307 void VisitDependentSizedExtVectorType(
328 if (EI.getNoReturn()) OS <<
" noreturn";
329 if (EI.getProducesResult()) OS <<
" produces_result";
330 if (EI.getHasRegParm()) OS <<
" regparm " << EI.
getRegParm();
336 if (EPI.HasTrailingReturn) OS <<
" trailing_return";
337 if (T->
isConst()) OS <<
" const";
340 switch (EPI.RefQualifier) {
347 VisitFunctionType(T);
351 dumpChild([=] { OS <<
"..."; });
368 OS <<
" underlying_type";
373 void VisitTagType(
const TagType *T) {
388 void VisitSubstTemplateTypeParmPackType(
393 void VisitAutoType(
const AutoType *T) {
402 dumpTemplateArgument(Arg);
403 if (T->isTypeAlias())
404 dumpTypeAsChild(T->getAliasedType());
418 void VisitPipeType(
const PipeType *T) {
435 void VisitEnumDecl(
const EnumDecl *D);
441 void VisitVarDecl(
const VarDecl *D);
463 template<
typename SpecializationDecl>
464 void VisitTemplateDeclSpecialization(
const SpecializationDecl *D,
465 bool DumpExplicitInst,
467 template<
typename TemplateDecl>
468 void VisitTemplateDecl(
const TemplateDecl *D,
bool DumpExplicitInst);
471 void VisitClassTemplateSpecializationDecl(
473 void VisitClassTemplatePartialSpecializationDecl(
475 void VisitClassScopeFunctionSpecializationDecl(
479 void VisitVarTemplateSpecializationDecl(
481 void VisitVarTemplatePartialSpecializationDecl(
578 const char *getCommandName(
unsigned CommandID);
579 void dumpComment(
const Comment *C);
601 void ASTDumper::dumpPointer(
const void *Ptr) {
602 ColorScope Color(*
this, AddressColor);
610 ColorScope Color(*
this, LocationColor);
618 OS <<
"<invalid sloc>";
622 if (strcmp(PLoc.
getFilename(), LastLocFilename) != 0) {
627 }
else if (PLoc.
getLine() != LastLocLine) {
628 OS <<
"line" <<
':' << PLoc.
getLine()
654 ColorScope Color(*
this, TypeColor);
659 if (Desugar && !T.
isNull()) {
662 if (T_split != D_split)
667 void ASTDumper::dumpType(
QualType T) {
672 void ASTDumper::dumpTypeAsChild(
QualType T) {
675 return dumpTypeAsChild(SQT.
Ty);
681 dumpBareType(T,
false);
687 void ASTDumper::dumpTypeAsChild(
const Type *T) {
690 ColorScope Color(*
this, NullColor);
694 if (
const LocInfoType *LIT = llvm::dyn_cast<LocInfoType>(T)) {
696 ColorScope Color(*
this, TypeColor);
697 OS <<
"LocInfo Type";
700 dumpTypeAsChild(LIT->getTypeSourceInfo()->getType());
705 ColorScope Color(*
this, TypeColor);
710 dumpBareType(
QualType(T, 0),
false);
714 if (SingleStepDesugar !=
QualType(T, 0))
719 OS <<
" instantiation_dependent";
721 OS <<
" variably_modified";
723 OS <<
" contains_unexpanded_pack";
729 if (SingleStepDesugar !=
QualType(T, 0))
730 dumpTypeAsChild(SingleStepDesugar);
734 void ASTDumper::dumpBareDeclRef(
const Decl *D) {
736 ColorScope Color(*
this, NullColor);
742 ColorScope Color(*
this, DeclKindNameColor);
747 if (
const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
748 ColorScope Color(*
this, DeclNameColor);
749 OS <<
" '" << ND->getDeclName() <<
'\'';
752 if (
const ValueDecl *VD = dyn_cast<ValueDecl>(D))
753 dumpType(VD->getType());
756 void ASTDumper::dumpDeclRef(
const Decl *D,
const char *
Label) {
767 void ASTDumper::dumpName(
const NamedDecl *ND) {
769 ColorScope Color(*
this, DeclNameColor);
783 void ASTDumper::dumpDeclContext(
const DeclContext *DC) {
792 ColorScope Color(*
this, UndeserializedColor);
793 OS <<
"<undeserialized declarations>";
798 void ASTDumper::dumpLookups(
const DeclContext *DC,
bool DumpDecls) {
800 OS <<
"StoredDeclsMap ";
801 dumpBareDeclRef(cast<Decl>(DC));
806 dumpPointer(cast<Decl>(Primary));
820 OS <<
"DeclarationName ";
822 ColorScope Color(*
this, DeclNameColor);
823 OS <<
'\'' << Name <<
'\'';
829 dumpBareDeclRef(*RI);
831 if ((*RI)->isHidden())
837 std::function<void(Decl *)> DumpWithPrev = [&](
Decl *D) {
849 if (HasUndeserializedLookups) {
851 ColorScope Color(*
this, UndeserializedColor);
852 OS <<
"<undeserialized lookups>";
858 void ASTDumper::dumpAttr(
const Attr *A) {
861 ColorScope Color(*
this, AttrColor);
864 #define ATTR(X) case attr::X: OS << #X; break; 865 #include "clang/Basic/AttrList.inc" 875 #include "clang/AST/AttrDump.inc" 885 OS <<
" first " << First;
892 OS <<
" prev " << Prev;
899 #define DECL(DERIVED, BASE) \ 900 case Decl::DERIVED: \ 901 return dumpPreviousDeclImpl(OS, cast<DERIVED##Decl>(D)); 902 #define ABSTRACT_DECL(DECL) 903 #include "clang/AST/DeclNodes.inc" 905 llvm_unreachable(
"Decl that isn't part of DeclNodes.inc!");
930 OS <<
"CXXCtorInitializer";
939 llvm_unreachable(
"Unknown initializer type");
954 void ASTDumper::dumpTemplateArgumentListInfo(
956 for (
unsigned i = 0, e = TALI.
size(); i < e; ++i)
957 dumpTemplateArgumentLoc(TALI[i]);
965 for (
unsigned i = 0, e = TAL.
size(); i < e; ++i)
966 dumpTemplateArgument(TAL[i]);
971 OS <<
"TemplateArgument";
998 OS <<
" template expansion";
1009 dumpTemplateArgument(*I);
1022 for (
auto typeParam : *typeParams) {
1023 dumpDecl(typeParam);
1031 void ASTDumper::dumpDecl(
const Decl *D) {
1034 ColorScope Color(*
this, NullColor);
1040 ColorScope Color(*
this, DeclKindNameColor);
1053 OS <<
" in " << M->getFullModuleName();
1054 if (
auto *ND = dyn_cast<NamedDecl>(D))
1056 const_cast<NamedDecl *>(ND)))
1057 dumpChild([=] { OS <<
"also in " << M->getFullModuleName(); });
1058 if (
const NamedDecl *ND = dyn_cast<NamedDecl>(D))
1066 OS <<
" referenced";
1069 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
1070 if (FD->isConstexpr())
1085 if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D) &&
1086 hasNodes(dyn_cast<DeclContext>(D)))
1087 dumpDeclContext(cast<DeclContext>(D));
1091 void ASTDumper::VisitLabelDecl(
const LabelDecl *D) {
1095 void ASTDumper::VisitTypedefDecl(
const TypedefDecl *D) {
1099 OS <<
" __module_private__";
1103 void ASTDumper::VisitEnumDecl(
const EnumDecl *D) {
1112 OS <<
" __module_private__";
1117 void ASTDumper::VisitRecordDecl(
const RecordDecl *D) {
1121 OS <<
" __module_private__";
1123 OS <<
" definition";
1137 for (
auto *Child : D->
chain())
1141 void ASTDumper::VisitFunctionDecl(
const FunctionDecl *D) {
1153 OS <<
" __module_private__";
1182 dumpTemplateArgumentList(*FTSI->TemplateArguments);
1185 dumpChild([=] { OS <<
"<<NULL params x " << D->
getNumParams() <<
">>"; });
1194 dumpCXXCtorInitializer(*I);
1197 if (MD->size_overridden_methods() != 0) {
1200 OS << D <<
" " << D->
getParent()->getName()
1206 auto Overrides = MD->overridden_methods();
1207 OS <<
"Overrides: [ ";
1208 dumpOverride(*Overrides.begin());
1209 for (
const auto *Override :
1210 llvm::make_range(Overrides.begin() + 1, Overrides.end())) {
1212 dumpOverride(Override);
1223 void ASTDumper::VisitFieldDecl(
const FieldDecl *D) {
1229 OS <<
" __module_private__";
1237 void ASTDumper::VisitVarDecl(
const VarDecl *D) {
1249 OS <<
" __module_private__";
1272 void ASTDumper::VisitBindingDecl(
const BindingDecl *D) {
1283 void ASTDumper::VisitImportDecl(
const ImportDecl *D) {
1290 case PCK_Unknown: llvm_unreachable(
"unexpected pragma comment kind");
1293 case PCK_Lib: OS <<
"lib";
break;
1295 case PCK_User: OS <<
"user";
break;
1297 StringRef Arg = D->
getArg();
1299 OS <<
" \"" << Arg <<
"\"";
1302 void ASTDumper::VisitPragmaDetectMismatchDecl(
1307 void ASTDumper::VisitCapturedDecl(
const CapturedDecl *D) {
1326 OS <<
" initializer";
1329 OS <<
" omp_priv = ";
1332 OS <<
" omp_priv ()";
1337 dumpStmt(Initializer);
1351 void ASTDumper::VisitNamespaceDecl(
const NamespaceDecl *D) {
1369 void ASTDumper::VisitTypeAliasDecl(
const TypeAliasDecl *D) {
1381 void ASTDumper::VisitCXXRecordDecl(
const CXXRecordDecl *D) {
1388 ColorScope Color(*
this, DeclKindNameColor);
1389 OS <<
"DefinitionData";
1391 #define FLAG(fn, name) if (D->fn()) OS << " " #name; 1392 FLAG(isParsingBaseSpecifiers, parsing_base_specifiers);
1394 FLAG(isGenericLambda,
generic);
1395 FLAG(isLambda, lambda);
1397 FLAG(canPassInRegisters, pass_in_registers);
1398 FLAG(isEmpty, empty);
1399 FLAG(isAggregate, aggregate);
1400 FLAG(isStandardLayout, standard_layout);
1401 FLAG(isTriviallyCopyable, trivially_copyable);
1404 FLAG(isPolymorphic, polymorphic);
1405 FLAG(isAbstract,
abstract);
1408 FLAG(hasUserDeclaredConstructor, has_user_declared_ctor);
1409 FLAG(hasConstexprNonCopyMoveConstructor, has_constexpr_non_copy_move_ctor);
1410 FLAG(hasMutableFields, has_mutable_fields);
1411 FLAG(hasVariantMembers, has_variant_members);
1412 FLAG(allowConstDefaultInit, can_const_default_init);
1416 ColorScope Color(*
this, DeclKindNameColor);
1417 OS <<
"DefaultConstructor";
1419 FLAG(hasDefaultConstructor, exists);
1420 FLAG(hasTrivialDefaultConstructor, trivial);
1421 FLAG(hasNonTrivialDefaultConstructor, non_trivial);
1422 FLAG(hasUserProvidedDefaultConstructor, user_provided);
1423 FLAG(hasConstexprDefaultConstructor, constexpr);
1424 FLAG(needsImplicitDefaultConstructor, needs_implicit);
1425 FLAG(defaultedDefaultConstructorIsConstexpr, defaulted_is_constexpr);
1430 ColorScope Color(*
this, DeclKindNameColor);
1431 OS <<
"CopyConstructor";
1433 FLAG(hasSimpleCopyConstructor, simple);
1434 FLAG(hasTrivialCopyConstructor, trivial);
1435 FLAG(hasNonTrivialCopyConstructor, non_trivial);
1436 FLAG(hasUserDeclaredCopyConstructor, user_declared);
1437 FLAG(hasCopyConstructorWithConstParam, has_const_param);
1438 FLAG(needsImplicitCopyConstructor, needs_implicit);
1439 FLAG(needsOverloadResolutionForCopyConstructor,
1440 needs_overload_resolution);
1442 FLAG(defaultedCopyConstructorIsDeleted, defaulted_is_deleted);
1443 FLAG(implicitCopyConstructorHasConstParam, implicit_has_const_param);
1448 ColorScope Color(*
this, DeclKindNameColor);
1449 OS <<
"MoveConstructor";
1451 FLAG(hasMoveConstructor, exists);
1452 FLAG(hasSimpleMoveConstructor, simple);
1453 FLAG(hasTrivialMoveConstructor, trivial);
1454 FLAG(hasNonTrivialMoveConstructor, non_trivial);
1455 FLAG(hasUserDeclaredMoveConstructor, user_declared);
1456 FLAG(needsImplicitMoveConstructor, needs_implicit);
1457 FLAG(needsOverloadResolutionForMoveConstructor,
1458 needs_overload_resolution);
1460 FLAG(defaultedMoveConstructorIsDeleted, defaulted_is_deleted);
1465 ColorScope Color(*
this, DeclKindNameColor);
1466 OS <<
"CopyAssignment";
1468 FLAG(hasTrivialCopyAssignment, trivial);
1469 FLAG(hasNonTrivialCopyAssignment, non_trivial);
1470 FLAG(hasCopyAssignmentWithConstParam, has_const_param);
1471 FLAG(hasUserDeclaredCopyAssignment, user_declared);
1472 FLAG(needsImplicitCopyAssignment, needs_implicit);
1473 FLAG(needsOverloadResolutionForCopyAssignment, needs_overload_resolution);
1474 FLAG(implicitCopyAssignmentHasConstParam, implicit_has_const_param);
1479 ColorScope Color(*
this, DeclKindNameColor);
1480 OS <<
"MoveAssignment";
1482 FLAG(hasMoveAssignment, exists);
1483 FLAG(hasSimpleMoveAssignment, simple);
1484 FLAG(hasTrivialMoveAssignment, trivial);
1485 FLAG(hasNonTrivialMoveAssignment, non_trivial);
1486 FLAG(hasUserDeclaredMoveAssignment, user_declared);
1487 FLAG(needsImplicitMoveAssignment, needs_implicit);
1488 FLAG(needsOverloadResolutionForMoveAssignment, needs_overload_resolution);
1493 ColorScope Color(*
this, DeclKindNameColor);
1496 FLAG(hasSimpleDestructor, simple);
1497 FLAG(hasIrrelevantDestructor, irrelevant);
1498 FLAG(hasTrivialDestructor, trivial);
1499 FLAG(hasNonTrivialDestructor, non_trivial);
1500 FLAG(hasUserDeclaredDestructor, user_declared);
1501 FLAG(needsImplicitDestructor, needs_implicit);
1502 FLAG(needsOverloadResolutionForDestructor, needs_overload_resolution);
1504 FLAG(defaultedDestructorIsDeleted, defaulted_is_deleted);
1508 for (
const auto &I : D->
bases()) {
1512 dumpAccessSpecifier(I.getAccessSpecifier());
1513 dumpType(I.getType());
1514 if (I.isPackExpansion())
1525 template<
typename SpecializationDecl>
1526 void ASTDumper::VisitTemplateDeclSpecialization(
const SpecializationDecl *D,
1527 bool DumpExplicitInst,
1529 bool DumpedAny =
false;
1530 for (
auto *RedeclWithBadType : D->redecls()) {
1534 auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
1538 assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
1539 "expected an injected-class-name");
1543 switch (Redecl->getTemplateSpecializationKind()) {
1546 if (!DumpExplicitInst)
1552 dumpDeclRef(Redecl);
1567 template<
typename TemplateDecl>
1568 void ASTDumper::VisitTemplateDecl(
const TemplateDecl *D,
1569 bool DumpExplicitInst) {
1575 for (
auto *Child : D->specializations())
1576 VisitTemplateDeclSpecialization(Child, DumpExplicitInst,
1584 VisitTemplateDecl(D,
true);
1588 VisitTemplateDecl(D,
false);
1591 void ASTDumper::VisitClassTemplateSpecializationDecl(
1593 VisitCXXRecordDecl(D);
1597 void ASTDumper::VisitClassTemplatePartialSpecializationDecl(
1599 VisitClassTemplateSpecializationDecl(D);
1603 void ASTDumper::VisitClassScopeFunctionSpecializationDecl(
1611 VisitTemplateDecl(D,
false);
1619 void ASTDumper::VisitVarTemplateSpecializationDecl(
1625 void ASTDumper::VisitVarTemplatePartialSpecializationDecl(
1628 VisitVarTemplateSpecializationDecl(D);
1654 void ASTDumper::VisitTemplateTemplateParmDecl(
1665 void ASTDumper::VisitUsingDecl(
const UsingDecl *D) {
1672 void ASTDumper::VisitUnresolvedUsingTypenameDecl(
1692 dumpTypeAsChild(TD->getTypeForDecl());
1695 void ASTDumper::VisitConstructorUsingShadowDecl(
1713 OS <<
"constructed ";
1732 void ASTDumper::VisitFriendDecl(
const FriendDecl *D) {
1734 dumpType(T->getType());
1743 void ASTDumper::VisitObjCIvarDecl(
const ObjCIvarDecl *D) {
1747 OS <<
" synthesize";
1784 dumpChild([=] { OS <<
"..."; });
1801 OS <<
" contravariant";
1851 dumpCXXCtorInitializer(*I);
1889 OS <<
" unsafe_unretained";
1902 OS <<
" synthesize";
1909 void ASTDumper::VisitBlockDecl(
const BlockDecl *D) {
1914 dumpChild([=]{ OS <<
"..."; });
1917 dumpChild([=]{ OS <<
"capture this"; });
1919 for (
const auto &I : D->
captures()) {
1926 if (I.getVariable()) {
1928 dumpBareDeclRef(I.getVariable());
1930 if (I.hasCopyExpr())
1931 dumpStmt(I.getCopyExpr());
1941 void ASTDumper::dumpStmt(
const Stmt *S) {
1944 ColorScope Color(*
this, NullColor);
1949 if (
const DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
1961 void ASTDumper::VisitStmt(
const Stmt *
Node) {
1963 ColorScope Color(*
this, StmtColor);
1970 void ASTDumper::VisitDeclStmt(
const DeclStmt *Node) {
1978 void ASTDumper::VisitAttributedStmt(
const AttributedStmt *Node) {
1986 void ASTDumper::VisitLabelStmt(
const LabelStmt *Node) {
1988 OS <<
" '" << Node->
getName() <<
"'";
1991 void ASTDumper::VisitGotoStmt(
const GotoStmt *Node) {
1997 void ASTDumper::VisitCXXCatchStmt(
const CXXCatchStmt *Node) {
2002 void ASTDumper::VisitCapturedStmt(
const CapturedStmt *Node) {
2011 void ASTDumper::VisitOMPExecutableDirective(
2014 for (
auto *C : Node->
clauses()) {
2017 ColorScope Color(*
this, NullColor);
2018 OS <<
"<<<NULL>>> OMPClause";
2022 ColorScope Color(*
this, AttrColor);
2024 OS <<
"OMP" << ClauseName.substr(0, 1).upper()
2025 << ClauseName.drop_front() <<
"Clause";
2028 dumpSourceRange(
SourceRange(C->getLocStart(), C->getLocEnd()));
2029 if (C->isImplicit())
2030 OS <<
" <implicit>";
2031 for (
auto *S : C->children())
2041 void ASTDumper::VisitExpr(
const Expr *Node) {
2046 ColorScope Color(*
this, ValueKindColor);
2060 ColorScope Color(*
this, ObjectKindColor);
2068 OS <<
" objcproperty";
2071 OS <<
" objcsubscript";
2074 OS <<
" vectorcomponent";
2105 void ASTDumper::VisitCastExpr(
const CastExpr *Node) {
2109 ColorScope Color(*
this, CastColor);
2116 void ASTDumper::VisitDeclRefExpr(
const DeclRefExpr *Node) {
2120 dumpBareDeclRef(Node->
getDecl());
2133 OS <<
"ADL) = '" << Node->
getName() <<
'\'';
2147 ColorScope Color(*
this, DeclKindNameColor);
2150 OS <<
"='" << *Node->
getDecl() <<
"'";
2153 OS <<
" isFreeIvar";
2156 void ASTDumper::VisitPredefinedExpr(
const PredefinedExpr *Node) {
2163 ColorScope Color(*
this, ValueColor);
2167 void ASTDumper::VisitIntegerLiteral(
const IntegerLiteral *Node) {
2171 ColorScope Color(*
this, ValueColor);
2172 OS <<
" " << Node->
getValue().toString(10, isSigned);
2177 ColorScope Color(*
this, ValueColor);
2181 void ASTDumper::VisitStringLiteral(
const StringLiteral *Str) {
2183 ColorScope Color(*
this, ValueColor);
2188 void ASTDumper::VisitInitListExpr(
const InitListExpr *ILE) {
2192 OS <<
"array filler";
2198 dumpBareDeclRef(Field);
2210 void ASTDumper::VisitUnaryOperator(
const UnaryOperator *Node) {
2212 OS <<
" " << (Node->
isPostfix() ?
"postfix" :
"prefix")
2216 void ASTDumper::VisitUnaryExprOrTypeTraitExpr(
2230 OS <<
" __builtin_omp_required_simd_align";
2237 void ASTDumper::VisitMemberExpr(
const MemberExpr *Node) {
2248 void ASTDumper::VisitBinaryOperator(
const BinaryOperator *Node) {
2253 void ASTDumper::VisitCompoundAssignOperator(
2257 <<
"' ComputeLHSTy=";
2259 OS <<
" ComputeResultTy=";
2263 void ASTDumper::VisitBlockExpr(
const BlockExpr *Node) {
2277 void ASTDumper::VisitAddrLabelExpr(
const AddrLabelExpr *Node) {
2298 OS <<
" " << (Node->
getValue() ?
"true" :
"false");
2301 void ASTDumper::VisitCXXThisExpr(
const CXXThisExpr *Node) {
2312 void ASTDumper::VisitCXXUnresolvedConstructExpr(
2329 OS <<
" std::initializer_list";
2340 void ASTDumper::VisitCXXNewExpr(
const CXXNewExpr *Node) {
2354 void ASTDumper::VisitCXXDeleteExpr(
const CXXDeleteExpr *Node) {
2370 OS <<
" extended by ";
2371 dumpBareDeclRef(VD);
2377 for (
unsigned i = 0, e = Node->
getNumObjects(); i != e; ++i)
2378 dumpDeclRef(Node->
getObject(i),
"cleanup");
2381 void ASTDumper::dumpCXXTemporary(
const CXXTemporary *Temporary) {
2382 OS <<
"(CXXTemporary";
2383 dumpPointer(Temporary);
2387 void ASTDumper::VisitSizeOfPackExpr(
const SizeOfPackExpr *Node) {
2393 dumpTemplateArgument(A);
2396 void ASTDumper::VisitCXXDependentScopeMemberExpr(
2420 OS <<
" super (instance)";
2424 OS <<
" super (class)";
2429 void ASTDumper::VisitObjCBoxedExpr(
const ObjCBoxedExpr *Node) {
2433 BoxingMethod->getSelector().print(OS);
2440 dumpDecl(CatchParam);
2445 void ASTDumper::VisitObjCEncodeExpr(
const ObjCEncodeExpr *Node) {
2466 OS <<
" Kind=MethodRef Getter=\"";
2472 OS <<
"\" Setter=\"";
2474 Setter->getSelector().print(OS);
2485 OS <<
" Messaging=";
2487 OS <<
"Getter&Setter";
2497 OS <<
" Kind=ArraySubscript GetterForArray=\"";
2499 OS <<
" Kind=DictionarySubscript GetterForDictionary=\"";
2506 OS <<
"\" SetterForArray=\"";
2508 OS <<
"\" SetterForDictionary=\"";
2517 OS <<
" " << (Node->
getValue() ?
"__objc_yes" :
"__objc_no");
2524 const char *ASTDumper::getCommandName(
unsigned CommandID) {
2530 return "<not a builtin command>";
2533 void ASTDumper::dumpFullComment(
const FullComment *C) {
2542 void ASTDumper::dumpComment(
const Comment *C) {
2545 ColorScope Color(*
this, NullColor);
2551 ColorScope Color(*
this, CommentColor);
2563 void ASTDumper::visitTextComment(
const TextComment *C) {
2564 OS <<
" Text=\"" << C->
getText() <<
"\"";
2568 OS <<
" Name=\"" << getCommandName(C->
getCommandID()) <<
"\"";
2571 OS <<
" RenderNormal";
2574 OS <<
" RenderBold";
2577 OS <<
" RenderMonospaced";
2580 OS <<
" RenderEmphasized";
2584 for (
unsigned i = 0, e = C->
getNumArgs(); i != e; ++i)
2585 OS <<
" Arg[" << i <<
"]=\"" << C->
getArgText(i) <<
"\"";
2592 for (
unsigned i = 0, e = C->
getNumAttrs(); i != e; ++i) {
2594 OS <<
" \"" << Attr.
Name <<
"=\"" << Attr.
Value <<
"\"";
2598 OS <<
" SelfClosing";
2606 OS <<
" Name=\"" << getCommandName(C->
getCommandID()) <<
"\"";
2607 for (
unsigned i = 0, e = C->
getNumArgs(); i != e; ++i)
2608 OS <<
" Arg[" << i <<
"]=\"" << C->
getArgText(i) <<
"\"";
2615 OS <<
" explicitly";
2617 OS <<
" implicitly";
2639 OS <<
" Position=<";
2640 for (
unsigned i = 0, e = C->
getDepth(); i != e; ++i) {
2650 OS <<
" Name=\"" << getCommandName(C->
getCommandID()) <<
"\"" 2654 void ASTDumper::visitVerbatimBlockLineComment(
2656 OS <<
" Text=\"" << C->
getText() <<
"\"";
2660 OS <<
" Text=\"" << C->
getText() <<
"\"";
2669 llvm::errs() << msg <<
": ";
2676 ASTDumper Dumper(OS,
nullptr,
nullptr);
2677 Dumper.dumpTypeAsChild(*
this);
2692 LLVM_DUMP_METHOD
void Decl::dump(raw_ostream &OS,
bool Deserialize)
const {
2697 P.setDeserialize(Deserialize);
2710 dumpLookups(llvm::errs());
2715 bool Deserialize)
const {
2719 ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
2723 P.setDeserialize(Deserialize);
2724 P.dumpLookups(
this, DumpDecls);
2732 dump(llvm::errs(), SM);
2736 ASTDumper
P(OS,
nullptr, &SM);
2741 ASTDumper
P(OS,
nullptr,
nullptr);
2746 ASTDumper
P(llvm::errs(),
nullptr,
nullptr);
2751 ASTDumper
P(llvm::errs(),
nullptr,
nullptr,
true);
2760 dump(llvm::errs(),
nullptr,
nullptr);
2771 ASTDumper D(OS, Traits, SM);
2772 D.dumpFullComment(FC);
2777 ASTDumper D(llvm::errs(),
nullptr,
nullptr,
true);
2778 D.dumpFullComment(FC);
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
The receiver is the instance of the superclass object.
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
Defines the clang::ASTContext interface.
const BlockDecl * getBlockDecl() const
const Type * Ty
The locally-unqualified type.
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
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.
Expr * getInit() const
Get the initializer.
bool isThisDeclarationADefinition() const
Returns whether this specific method is a definition.
decl_iterator noload_decls_begin() const
protocol_range protocols() const
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getElementType() const
QualType getPointeeType() const
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
A (possibly-)qualified type.
const char * getDeclKindName() const
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
ArrayRef< OMPClause * > clauses()
ObjCMethodDecl * getAtIndexMethodDecl() const
ObjCInterfaceDecl * getClassInterface()
Selector getSelector() const
ConstStmtVisitor - This class implements a simple visitor for Stmt subclasses.
ObjCIvarDecl * getPropertyIvarDecl() const
bool isSuperReceiver() const
bool isListInitialization() const
Determine whether this expression models list-initialization.
Expr * getUnderlyingExpr() const
attr_iterator attr_begin() const
ObjCProtocolDecl * getProtocol() const
Stmt - This represents one statement.
Expr * getBitWidth() const
UnresolvedSetImpl::iterator decls_iterator
FunctionType - C99 6.7.5.3 - Function Declarators.
ObjCMethodDecl * setAtIndexMethodDecl() const
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
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...
unsigned size() const
Retrieve the number of template arguments in this template argument list.
bool isDecltypeAuto() const
Defines the clang::Module class, which describes a module in the source code.
Decl - This represents one declaration (or definition), e.g.
bool needsOverloadResolutionForDestructor() const
Determine whether we need to eagerly declare a destructor for this class.
TagDecl * getDecl() const
ObjCMethodDecl * getImplicitPropertySetter() const
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
FunctionDecl * getOperatorNew() const
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
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.
The base class of the type hierarchy.
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
Declaration of a variable template.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
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.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
A container of type source information.
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool hasExternalVisibleStorage() const
Whether this DeclContext has external storage containing additional declarations that are visible in ...
TemplateTypeParmDecl * getDecl() const
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 isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
bool needsOverloadResolutionForCopyConstructor() const
Determine whether we need to eagerly declare a defaulted copy constructor for this class...
QualType getElementType() const
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
CXXCtorInitializer *const * init_const_iterator
init_const_iterator - Iterates through the ivar initializer list.
const CXXBaseSpecifier *const * path_const_iterator
unsigned getDepth() const
Get the nesting depth of the template parameter.
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...
VarDecl - An instance of this class is created to represent a variable declaration or definition...
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
const T * getAs() const
Member-template getAs<specific type>'.
ObjCCategoryImplDecl * getImplementation() const
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Represents an empty template argument, e.g., one that has not been deduced.
Extra information about a function prototype.
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
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.
DeclarationName getName() const
Gets the name looked up.
const char * getName() const
bool isInvalidDecl() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Describes how types, statements, expressions, and declarations should be printed. ...
protocol_range protocols() const
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
ParmVarDecl - Represents a parameter to a function.
Represents the result of substituting a type for a template type parameter.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
const ObjCInterfaceDecl * getSuperClass() const
ObjCPropertyDecl * getExplicitProperty() const
const char * getStmtClassName() const
SourceLocation getAttributeLoc() const
LabelStmt - Represents a label, which has a substatement.
RecordDecl - Represents a struct/union/class.
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
const char * getOpenMPClauseName(OpenMPClauseKind Kind)
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Provides common interface for the Decls that can be redeclared.
QualType getOriginalType() const
Represents a class template specialization, which refers to a class template with a given set of temp...
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
unsigned getDepth() const
Retrieve the depth of the template parameter.
StringLiteral * getMessage()
QualType getComputationResultType() const
unsigned getRegParm() const
DeclGroupRef::const_iterator const_decl_iterator
bool isImplicit() const
Returns true if the attribute has been implicitly created instead of explicitly written by the user...
A vector component is an element or range of elements on a vector.
QualType getPointeeType() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool isInline() const
Returns true if this is an inline namespace declaration.
The results of name lookup within a DeclContext.
ArrayRef< QualType > getParamTypes() const
attr_iterator attr_end() 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 ...
all_lookups_iterator lookups_begin() const
Iterators over all possible lookups within this context.
bool isSpelledAsLValue() const
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
StringRef getValue() const
InitKind getInitializerKind() const
Get initializer kind.
ObjCMethodDecl * getSetterMethodDecl() const
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class. ...
Represents the result of substituting a set of types for a template type parameter pack...
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
void dumpColor() const
dumpColor - same as dump(), but forces color highlighting.
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 ':'.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
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.
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Selector getSelector() const
ArrayRef< ParmVarDecl * > parameters() const
Represents Objective-C's @catch statement.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
StringRef getOpcodeStr() const
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
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...
ArrayRef< BindingDecl * > bindings() const
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
UnresolvedUsingTypenameDecl * getDecl() const
bool isBitField() const
Determines whether this field is a bitfield.
An lvalue ref-qualifier was provided (&).
bool isMessagingSetter() const
True if the property reference will result in a message to the setter.
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
FunctionDecl * getOperatorDelete() const
std::string getFullModuleName(bool AllowStringLiterals=false) const
Retrieve the full name of this module, including the path from its top-level module.
bool isElidable() const
Whether this construction is elidable.
A convenient class for passing around template argument information.
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
ArrayRef< NamedDecl * > chain() const
An x-value expression is a reference to an object with independent storage but which can be "moved"...
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
path_iterator path_begin()
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
PropertyAttributeKind getPropertyAttributes() const
Represents a typeof (or typeof) expression (a GCC extension).
const clang::PrintingPolicy & getPrintingPolicy() const
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
A builtin binary operation expression such as "x + y" or "x <= y".
const Type * getClass() const
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
CXXRecordDecl * getDecl() const
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Expr * getSizeExpr() const
const char * getCastKindName() const
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
bool isAnyMemberInitializer() const
const Expr * getInitExpr() const
DiagnosticsEngine & getDiagnostics() const
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
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)...
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID. ...
CXXTemporary * getTemporary()
FieldDecl * getAnyMember() const
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
PropertyControl getPropertyImplementation() const
void * getAsOpaquePtr() const
An ordinary object is located at an address in memory.
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
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.
Represents a linkage specification.
QualType getReturnType() const
is ARM Neon polynomial vector
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
SplitQualType getSplitDesugaredType() const
A binding in a decomposition declaration.
Expr * getSizeExpr() const
QualType getElementType() const
Represents an extended vector type where either the type or size is dependent.
param_iterator param_begin()
static void dumpPreviousDeclImpl(raw_ostream &OS,...)
Represents the this expression in C++.
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
const ValueDecl * getExtendingDecl() const
Get the declaration which triggered the lifetime-extension of this temporary, if any.
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
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.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
QualType getComputationLHSType() const
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
decl_range noload_decls() const
noload_decls_begin/end - Iterate over the declarations stored in this context that are currently load...
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
Print this nested name specifier to the given output stream.
void outputString(raw_ostream &OS) const
CXXCtorInitializer *const * init_const_iterator
Iterates through the member/base initializer list.
unsigned getValue() const
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.
ObjCMethodDecl * getBoxingMethod() const
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
QualType getElementType() const
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
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...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
StringRef getKindName() const
QualType getPointeeType() const
bool isDefaulted() const
Whether this function is defaulted per C++0x.
bool isInvalid() const
Return true if this object is invalid or uninitialized.
static void dumpBasePath(raw_ostream &OS, const CastExpr *Node)
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
const FunctionProtoType * T
Declaration of a template type parameter.
unsigned getIndex() const
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
unsigned getLine() const
Return the presumed line number of this location.
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
VarDecl * getExceptionDecl() const
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
const char * getTypeClassName() const
QualType getArgumentType() const
comments::CommandTraits & getCommentCommandTraits() const
DeclContext * getDeclContext()
ObjCInterfaceDecl * getSuperClass() const
ObjCSelectorExpr used for @selector in Objective-C.
TLSKind getTLSKind() const
Represents an expression that computes the length of a parameter pack.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
ConstructorUsingShadowDecl * getNominatedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the direct base class from which this using shadow dec...
IdentifierInfo & getAccessor() const
Represents the type decltype(expr) (C++11).
decls_iterator decls_begin() const
CXXRecordDecl * getConstructedBaseClass() const
Get the base class whose constructor or constructor shadow declaration is passed the constructor argu...
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
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.
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
StorageClass
Storage classes.
void dump(raw_ostream &OS) const
Debugging aid that dumps the template name.
Direct list-initialization (C++11)
Qualifiers Quals
The local qualifiers.
Declaration of an alias template.
LabelDecl * getLabel() const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
QualType getEncodedType() const
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.
ObjCMethodDecl * getImplicitPropertyGetter() const
SourceLocation getEnd() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
bool isInstanceMethod() const
Represents a GCC generic vector type.
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
ArraySizeModifier getSizeModifier() const
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
StringRef getName() const
Selector getSelector() const
std::string getAsString() const
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
This template specialization was implicitly instantiated from a template.
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Expr * getUnderlyingExpr() const
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
bool hasQualifiers() const
Return true if the set contains any qualifiers.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
const char * getFilename() const
Return the presumed filename of this location.
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.
bool isImplicitProperty() const
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
ExtProtoInfo getExtProtoInfo() const
unsigned getColumn() const
Return the presumed column number of this location.
all_lookups_iterator lookups_end() const
bool isParameterPack() const
Returns whether this is a parameter pack.
Encodes a location in the source.
bool getSynthesize() const
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
QualType getReturnType() const
bool isPure() const
Whether this virtual function is pure, i.e.
ObjCProtocolList::iterator protocol_iterator
This represents '#pragma omp declare reduction ...' directive.
decl_iterator decls_begin() const
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Pseudo declaration for capturing expressions.
Represents a C++ temporary.
Interfaces are the core concept in Objective-C for object oriented design.
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
This is a basic class for representing single OpenMP executable directive.
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
std::string getNameAsString() const
getNameAsString - Get a human-readable name for the declaration, even if it is one of the special kin...
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
ArrayRef< const Attr * > getAttrs() const
TemplateArgument getArgumentPack() const
const TemplateArgumentListInfo & templateArgs() const
ASTContext & getASTContext() const LLVM_READONLY
ObjCCategoryDecl * getCategoryDecl() const
QualType getElementType() const
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
LabelDecl - Represents the declaration of a label.
Represents a dependent using declaration which was not marked with typename.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set...
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
Represents a static or instance method of a struct/union/class.
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
No ref-qualifier was provided.
C-style initialization with assignment.
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
This file defines OpenMP nodes for declarative directives.
bool isParameterPack() const
bool isLiteral(TokenKind K)
Return true if this is a "literal" kind, like a numeric constant, string, etc.
ObjCCategoryDecl - Represents a category declaration.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
UnaryExprOrTypeTrait getKind() const
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
decl_iterator decl_begin()
ObjCProtocolExpr used for protocol expression in Objective-C.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
is AltiVec 'vector bool ...'
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
ConstructorUsingShadowDecl * getConstructedBaseClassShadowDecl() const
Get the inheriting constructor declaration for the base class for which we don't have an explicit ini...
Represents one property declaration in an Objective-C interface.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
bool isMessagingGetter() const
True if the property reference will result in a message to the getter.
Qualifiers getIndexTypeQualifiers() const
This template specialization was instantiated from a template due to an explicit instantiation defini...
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
IdentType getIdentType() const
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Represents a C++11 static_assert declaration.
An rvalue ref-qualifier was provided (&&).
SourceRange getBracketsRange() const
decl_iterator noload_decls_end() const
ObjCBoxedExpr - used for generalized expression boxing.
bool isArgumentType() const
ObjCImplementationDecl * getImplementation() const
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
std::string getAsString() const
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
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.
Represents a pack expansion of types.
CompoundAssignOperator - For compound assignments (e.g.
static const char * getStorageClassSpecifierString(StorageClass SC)
getStorageClassSpecifierString - Return the string used to specify the storage class SC...
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
SourceRange getRange() const
AddrLabelExpr - The GNU address of label extension, representing &&label.
ast_type_traits::DynTypedNode Node
TLS with a dynamic initializer.
Represents a template argument.
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
const ObjCInterfaceDecl * getClassInterface() const
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Dataflow Directional Tag Classes.
ExtInfo getExtInfo() const
const TemplateArgument & getArgument() 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...
bool hasExplicitTemplateArgs() const
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
ArrayRef< Capture > captures() const
The base class of all kinds of template declarations (e.g., class, function, etc.).
Kind getPropertyImplementation() const
The template argument is a pack expansion of a template name that was provided for a template templat...
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
QualType getUnderlyingType() const
AttrVec::const_iterator attr_iterator
AccessSpecifier getAccess() const
const Expr * getInit() const
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...
unsigned getIndex() const
Retrieve the index of the template parameter.
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
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.
VectorKind getVectorKind() const
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
EnumDecl - Represents an enum.
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
const ObjCInterfaceDecl * getClassInterface() const
bool isHidden() const
Determine whether this declaration might be hidden from name lookup.
llvm::APInt getValue() const
QualType getModifiedType() const
LabelDecl * getLabel() const
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
Represents a pointer to an Objective C object.
bool needsOverloadResolutionForMoveConstructor() const
Determine whether we need to eagerly declare a defaulted move constructor for this class...
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
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.
all_lookups_iterator noload_lookups_end() const
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given 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...
unsigned getNumObjects() const
ObjCEncodeExpr, used for @encode in Objective-C.
bool isFromAST() const
Whether this type comes from an AST file.
const llvm::APInt & getSize() const
protocol_iterator protocol_begin() const
bool hasBody() const override
Determine whether this method has a body.
Base for LValueReferenceType and RValueReferenceType.
SourceRange getBracketsRange() const
The template argument is a type.
The template argument is actually a parameter pack.
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
Represents a base class of a C++ class.
A bitfield object is a bitfield on a C or C++ record.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
SourceManager & getSourceManager()
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof...
bool capturesCXXThis() const
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
GotoStmt - This represents a direct goto.
A template argument list.
TypedefNameDecl * getDecl() const
pack_iterator pack_end() const
Iterator referencing one past the last argument of a template argument pack.
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
ArgKind getKind() const
Return the kind of stored template argument.
unsigned getDepth() const
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.
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
Represents a C++ struct/union/class.
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
Represents a loop initializing the elements of an array.
bool isTrivial(const SExpr *E)
The template argument is a template name that was provided for a template template parameter...
CXXCatchStmt - This represents a C++ catch block.
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
The parameter type of a method or function.
ObjCIvarDecl - Represents an ObjC instance variable.
CleanupObject getObject(unsigned i) const
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.
CXXMethodDecl * getSpecialization() const
protocol_iterator protocol_end() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
bool isGlobalDelete() const
StringLiteral - This represents a string literal expression, e.g.
TLS with a known-constant initializer.
QualType getIntegerType() const
getIntegerType - Return the integer type this enum decl corresponds to.
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body - that is, if it is a non-delete...
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
RetTy Visit(PTR(Stmt) S, ParamTys... P)
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
void dump(const char *s) const
bool constructsVirtualBase() const
Returns true if the constructed base class is a virtual base class subobject of this declaration's cl...
Abstract class common to all of the C++ "named"/"keyword" casts.
unsigned getNumElements() const
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
QualType getAsType() const
Retrieve the type for a type template argument.
A reference to a declared variable, function, enum, etc.
Represents a type template specialization; the template must be a class template, a type alias templa...
ArrayRef< ParmVarDecl * > parameters() const
ObjCPropertyDecl * getPropertyDecl() const
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
bool isDeleted() const
Whether this function has been deleted.
Expr * getBinding() const
Get the expression to which this declaration is bound.
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
const VarDecl * getCatchParamDecl() const
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".
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
QualType getDefaultArgument() const
Retrieve the default argument, if any.
bool isArraySubscriptRefExpr() const
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
static StringRef getNameForCallConv(CallingConv CC)
An l-value expression is a reference to an object with independent storage.
A trivial tuple used to represent a source range.
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined...
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to...
ObjCMethodDecl * getGetterMethodDecl() const
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
NamedDecl - This represents a decl with a name.
A boolean literal, per ([C++ lex.bool] Boolean literals).
bool isTranslationUnit() const
Represents a C array with a specified size that is not an integer-constant-expression.
Represents a C++ namespace alias.
bool isInline() const
Whether this variable is (C++1z) inline.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
AccessControl getAccessControl() const
Represents C++ using-directive.
Represents a #pragma detect_mismatch line.
double getValueAsApproximateDouble() const
getValueAsApproximateDouble - This returns the value as an inaccurate double.
attr::Kind getKind() const
The receiver is a superclass.
A simple visitor class that helps create declaration visitors.
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.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
SourceLocation getBegin() const
NamedDecl * getPack() const
Retrieve the parameter pack.
This represents '#pragma omp threadprivate ...' directive.
decls_iterator decls_end() const
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
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.
Attr - This represents one attribute.
bool isDeletedAsWritten() const
SourceLocation getLocation() const
const StringLiteral * getAsmString() const
QualType getPointeeType() const
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
all_lookups_iterator noload_lookups_begin() const
Iterators over all possible lookups within this context that are currently loaded; don't attempt to r...
QualType getType() const
Return the type wrapped by this type source info.
ArrayRef< ParmVarDecl * > parameters() const
NamedDecl * getAliasedNamespace() const
Retrieve the namespace that this alias refers to, which may either be a NamespaceDecl or a NamespaceA...
ObjCCompatibleAliasDecl - Represents alias of a class.
decl_iterator decls_end() const
Expr * getSizeExpr() const
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
QualType getType() const
Retrieves the type of the base class.