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(
581 const char *getCommandName(
unsigned CommandID);
582 void dumpComment(
const Comment *C);
604 void ASTDumper::dumpPointer(
const void *Ptr) {
605 ColorScope Color(*
this, AddressColor);
613 ColorScope Color(*
this, LocationColor);
621 OS <<
"<invalid sloc>";
625 if (strcmp(PLoc.
getFilename(), LastLocFilename) != 0) {
630 }
else if (PLoc.
getLine() != LastLocLine) {
631 OS <<
"line" <<
':' << PLoc.
getLine()
657 ColorScope Color(*
this, TypeColor);
662 if (Desugar && !T.
isNull()) {
665 if (T_split != D_split)
670 void ASTDumper::dumpType(
QualType T) {
675 void ASTDumper::dumpTypeAsChild(
QualType T) {
678 return dumpTypeAsChild(SQT.
Ty);
684 dumpBareType(T,
false);
690 void ASTDumper::dumpTypeAsChild(
const Type *T) {
693 ColorScope Color(*
this, NullColor);
697 if (
const LocInfoType *LIT = llvm::dyn_cast<LocInfoType>(T)) {
699 ColorScope Color(*
this, TypeColor);
700 OS <<
"LocInfo Type";
703 dumpTypeAsChild(LIT->getTypeSourceInfo()->getType());
708 ColorScope Color(*
this, TypeColor);
713 dumpBareType(
QualType(T, 0),
false);
717 if (SingleStepDesugar !=
QualType(T, 0))
722 OS <<
" instantiation_dependent";
724 OS <<
" variably_modified";
726 OS <<
" contains_unexpanded_pack";
732 if (SingleStepDesugar !=
QualType(T, 0))
733 dumpTypeAsChild(SingleStepDesugar);
737 void ASTDumper::dumpBareDeclRef(
const Decl *D) {
739 ColorScope Color(*
this, NullColor);
745 ColorScope Color(*
this, DeclKindNameColor);
750 if (
const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
751 ColorScope Color(*
this, DeclNameColor);
752 OS <<
" '" << ND->getDeclName() <<
'\'';
755 if (
const ValueDecl *VD = dyn_cast<ValueDecl>(D))
756 dumpType(VD->getType());
759 void ASTDumper::dumpDeclRef(
const Decl *D,
const char *
Label) {
770 void ASTDumper::dumpName(
const NamedDecl *ND) {
772 ColorScope Color(*
this, DeclNameColor);
786 void ASTDumper::dumpDeclContext(
const DeclContext *DC) {
795 ColorScope Color(*
this, UndeserializedColor);
796 OS <<
"<undeserialized declarations>";
801 void ASTDumper::dumpLookups(
const DeclContext *DC,
bool DumpDecls) {
803 OS <<
"StoredDeclsMap ";
804 dumpBareDeclRef(cast<Decl>(DC));
809 dumpPointer(cast<Decl>(Primary));
814 auto Range = Deserialize
817 for (
auto I = Range.begin(), E = Range.end(); I != E; ++I) {
822 OS <<
"DeclarationName ";
824 ColorScope Color(*
this, DeclNameColor);
825 OS <<
'\'' << Name <<
'\'';
831 dumpBareDeclRef(*RI);
833 if ((*RI)->isHidden())
839 std::function<void(Decl *)> DumpWithPrev = [&](
Decl *D) {
851 if (HasUndeserializedLookups) {
853 ColorScope Color(*
this, UndeserializedColor);
854 OS <<
"<undeserialized lookups>";
860 void ASTDumper::dumpAttr(
const Attr *A) {
863 ColorScope Color(*
this, AttrColor);
866 #define ATTR(X) case attr::X: OS << #X; break; 867 #include "clang/Basic/AttrList.inc" 877 #include "clang/AST/AttrDump.inc" 887 OS <<
" first " << First;
894 OS <<
" prev " << Prev;
901 #define DECL(DERIVED, BASE) \ 902 case Decl::DERIVED: \ 903 return dumpPreviousDeclImpl(OS, cast<DERIVED##Decl>(D)); 904 #define ABSTRACT_DECL(DECL) 905 #include "clang/AST/DeclNodes.inc" 907 llvm_unreachable(
"Decl that isn't part of DeclNodes.inc!");
932 OS <<
"CXXCtorInitializer";
941 llvm_unreachable(
"Unknown initializer type");
956 void ASTDumper::dumpTemplateArgumentListInfo(
958 for (
unsigned i = 0, e = TALI.
size(); i < e; ++i)
959 dumpTemplateArgumentLoc(TALI[i]);
967 for (
unsigned i = 0, e = TAL.
size(); i < e; ++i)
968 dumpTemplateArgument(TAL[i]);
973 OS <<
"TemplateArgument";
1000 OS <<
" template expansion";
1011 dumpTemplateArgument(*I);
1024 for (
auto typeParam : *typeParams) {
1025 dumpDecl(typeParam);
1033 void ASTDumper::dumpDecl(
const Decl *D) {
1036 ColorScope Color(*
this, NullColor);
1042 ColorScope Color(*
this, DeclKindNameColor);
1055 OS <<
" in " << M->getFullModuleName();
1056 if (
auto *ND = dyn_cast<NamedDecl>(D))
1058 const_cast<NamedDecl *>(ND)))
1059 dumpChild([=] { OS <<
"also in " << M->getFullModuleName(); });
1060 if (
const NamedDecl *ND = dyn_cast<NamedDecl>(D))
1068 OS <<
" referenced";
1071 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
1072 if (FD->isConstexpr())
1087 if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D) &&
1088 hasNodes(dyn_cast<DeclContext>(D)))
1089 dumpDeclContext(cast<DeclContext>(D));
1093 void ASTDumper::VisitLabelDecl(
const LabelDecl *D) {
1097 void ASTDumper::VisitTypedefDecl(
const TypedefDecl *D) {
1101 OS <<
" __module_private__";
1105 void ASTDumper::VisitEnumDecl(
const EnumDecl *D) {
1114 OS <<
" __module_private__";
1119 void ASTDumper::VisitRecordDecl(
const RecordDecl *D) {
1123 OS <<
" __module_private__";
1125 OS <<
" definition";
1139 for (
auto *Child : D->
chain())
1143 void ASTDumper::VisitFunctionDecl(
const FunctionDecl *D) {
1155 OS <<
" __module_private__";
1184 dumpTemplateArgumentList(*FTSI->TemplateArguments);
1187 dumpChild([=] { OS <<
"<<NULL params x " << D->
getNumParams() <<
">>"; });
1196 dumpCXXCtorInitializer(*I);
1199 if (MD->size_overridden_methods() != 0) {
1202 OS << D <<
" " << D->
getParent()->getName()
1208 auto Overrides = MD->overridden_methods();
1209 OS <<
"Overrides: [ ";
1210 dumpOverride(*Overrides.begin());
1211 for (
const auto *Override :
1212 llvm::make_range(Overrides.begin() + 1, Overrides.end())) {
1214 dumpOverride(Override);
1225 void ASTDumper::VisitFieldDecl(
const FieldDecl *D) {
1231 OS <<
" __module_private__";
1239 void ASTDumper::VisitVarDecl(
const VarDecl *D) {
1251 OS <<
" __module_private__";
1274 void ASTDumper::VisitBindingDecl(
const BindingDecl *D) {
1285 void ASTDumper::VisitImportDecl(
const ImportDecl *D) {
1292 case PCK_Unknown: llvm_unreachable(
"unexpected pragma comment kind");
1295 case PCK_Lib: OS <<
"lib";
break;
1297 case PCK_User: OS <<
"user";
break;
1299 StringRef Arg = D->
getArg();
1301 OS <<
" \"" << Arg <<
"\"";
1304 void ASTDumper::VisitPragmaDetectMismatchDecl(
1309 void ASTDumper::VisitCapturedDecl(
const CapturedDecl *D) {
1328 OS <<
" initializer";
1331 OS <<
" omp_priv = ";
1334 OS <<
" omp_priv ()";
1339 dumpStmt(Initializer);
1353 void ASTDumper::VisitNamespaceDecl(
const NamespaceDecl *D) {
1371 void ASTDumper::VisitTypeAliasDecl(
const TypeAliasDecl *D) {
1383 void ASTDumper::VisitCXXRecordDecl(
const CXXRecordDecl *D) {
1390 ColorScope Color(*
this, DeclKindNameColor);
1391 OS <<
"DefinitionData";
1393 #define FLAG(fn, name) if (D->fn()) OS << " " #name; 1394 FLAG(isParsingBaseSpecifiers, parsing_base_specifiers);
1396 FLAG(isGenericLambda,
generic);
1397 FLAG(isLambda, lambda);
1400 FLAG(isEmpty, empty);
1401 FLAG(isAggregate, aggregate);
1402 FLAG(isStandardLayout, standard_layout);
1403 FLAG(isTriviallyCopyable, trivially_copyable);
1406 FLAG(isPolymorphic, polymorphic);
1407 FLAG(isAbstract,
abstract);
1410 FLAG(hasUserDeclaredConstructor, has_user_declared_ctor);
1411 FLAG(hasConstexprNonCopyMoveConstructor, has_constexpr_non_copy_move_ctor);
1412 FLAG(hasMutableFields, has_mutable_fields);
1413 FLAG(hasVariantMembers, has_variant_members);
1414 FLAG(allowConstDefaultInit, can_const_default_init);
1418 ColorScope Color(*
this, DeclKindNameColor);
1419 OS <<
"DefaultConstructor";
1421 FLAG(hasDefaultConstructor, exists);
1422 FLAG(hasTrivialDefaultConstructor, trivial);
1423 FLAG(hasNonTrivialDefaultConstructor, non_trivial);
1424 FLAG(hasUserProvidedDefaultConstructor, user_provided);
1425 FLAG(hasConstexprDefaultConstructor, constexpr);
1426 FLAG(needsImplicitDefaultConstructor, needs_implicit);
1427 FLAG(defaultedDefaultConstructorIsConstexpr, defaulted_is_constexpr);
1432 ColorScope Color(*
this, DeclKindNameColor);
1433 OS <<
"CopyConstructor";
1435 FLAG(hasSimpleCopyConstructor, simple);
1436 FLAG(hasTrivialCopyConstructor, trivial);
1437 FLAG(hasNonTrivialCopyConstructor, non_trivial);
1438 FLAG(hasUserDeclaredCopyConstructor, user_declared);
1439 FLAG(hasCopyConstructorWithConstParam, has_const_param);
1440 FLAG(needsImplicitCopyConstructor, needs_implicit);
1441 FLAG(needsOverloadResolutionForCopyConstructor,
1442 needs_overload_resolution);
1444 FLAG(defaultedCopyConstructorIsDeleted, defaulted_is_deleted);
1445 FLAG(implicitCopyConstructorHasConstParam, implicit_has_const_param);
1450 ColorScope Color(*
this, DeclKindNameColor);
1451 OS <<
"MoveConstructor";
1453 FLAG(hasMoveConstructor, exists);
1454 FLAG(hasSimpleMoveConstructor, simple);
1455 FLAG(hasTrivialMoveConstructor, trivial);
1456 FLAG(hasNonTrivialMoveConstructor, non_trivial);
1457 FLAG(hasUserDeclaredMoveConstructor, user_declared);
1458 FLAG(needsImplicitMoveConstructor, needs_implicit);
1459 FLAG(needsOverloadResolutionForMoveConstructor,
1460 needs_overload_resolution);
1462 FLAG(defaultedMoveConstructorIsDeleted, defaulted_is_deleted);
1467 ColorScope Color(*
this, DeclKindNameColor);
1468 OS <<
"CopyAssignment";
1470 FLAG(hasTrivialCopyAssignment, trivial);
1471 FLAG(hasNonTrivialCopyAssignment, non_trivial);
1472 FLAG(hasCopyAssignmentWithConstParam, has_const_param);
1473 FLAG(hasUserDeclaredCopyAssignment, user_declared);
1474 FLAG(needsImplicitCopyAssignment, needs_implicit);
1475 FLAG(needsOverloadResolutionForCopyAssignment, needs_overload_resolution);
1476 FLAG(implicitCopyAssignmentHasConstParam, implicit_has_const_param);
1481 ColorScope Color(*
this, DeclKindNameColor);
1482 OS <<
"MoveAssignment";
1484 FLAG(hasMoveAssignment, exists);
1485 FLAG(hasSimpleMoveAssignment, simple);
1486 FLAG(hasTrivialMoveAssignment, trivial);
1487 FLAG(hasNonTrivialMoveAssignment, non_trivial);
1488 FLAG(hasUserDeclaredMoveAssignment, user_declared);
1489 FLAG(needsImplicitMoveAssignment, needs_implicit);
1490 FLAG(needsOverloadResolutionForMoveAssignment, needs_overload_resolution);
1495 ColorScope Color(*
this, DeclKindNameColor);
1498 FLAG(hasSimpleDestructor, simple);
1499 FLAG(hasIrrelevantDestructor, irrelevant);
1500 FLAG(hasTrivialDestructor, trivial);
1501 FLAG(hasNonTrivialDestructor, non_trivial);
1502 FLAG(hasUserDeclaredDestructor, user_declared);
1503 FLAG(needsImplicitDestructor, needs_implicit);
1504 FLAG(needsOverloadResolutionForDestructor, needs_overload_resolution);
1506 FLAG(defaultedDestructorIsDeleted, defaulted_is_deleted);
1510 for (
const auto &I : D->
bases()) {
1514 dumpAccessSpecifier(I.getAccessSpecifier());
1515 dumpType(I.getType());
1516 if (I.isPackExpansion())
1527 template<
typename SpecializationDecl>
1528 void ASTDumper::VisitTemplateDeclSpecialization(
const SpecializationDecl *D,
1529 bool DumpExplicitInst,
1531 bool DumpedAny =
false;
1532 for (
auto *RedeclWithBadType : D->redecls()) {
1536 auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
1540 assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
1541 "expected an injected-class-name");
1545 switch (Redecl->getTemplateSpecializationKind()) {
1548 if (!DumpExplicitInst)
1554 dumpDeclRef(Redecl);
1569 template<
typename TemplateDecl>
1570 void ASTDumper::VisitTemplateDecl(
const TemplateDecl *D,
1571 bool DumpExplicitInst) {
1577 for (
auto *Child : D->specializations())
1578 VisitTemplateDeclSpecialization(Child, DumpExplicitInst,
1586 VisitTemplateDecl(D,
true);
1590 VisitTemplateDecl(D,
false);
1593 void ASTDumper::VisitClassTemplateSpecializationDecl(
1595 VisitCXXRecordDecl(D);
1599 void ASTDumper::VisitClassTemplatePartialSpecializationDecl(
1601 VisitClassTemplateSpecializationDecl(D);
1605 void ASTDumper::VisitClassScopeFunctionSpecializationDecl(
1613 VisitTemplateDecl(D,
false);
1621 void ASTDumper::VisitVarTemplateSpecializationDecl(
1627 void ASTDumper::VisitVarTemplatePartialSpecializationDecl(
1630 VisitVarTemplateSpecializationDecl(D);
1656 void ASTDumper::VisitTemplateTemplateParmDecl(
1667 void ASTDumper::VisitUsingDecl(
const UsingDecl *D) {
1674 void ASTDumper::VisitUnresolvedUsingTypenameDecl(
1694 dumpTypeAsChild(TD->getTypeForDecl());
1697 void ASTDumper::VisitConstructorUsingShadowDecl(
1715 OS <<
"constructed ";
1734 void ASTDumper::VisitFriendDecl(
const FriendDecl *D) {
1736 dumpType(T->getType());
1745 void ASTDumper::VisitObjCIvarDecl(
const ObjCIvarDecl *D) {
1749 OS <<
" synthesize";
1786 dumpChild([=] { OS <<
"..."; });
1803 OS <<
" contravariant";
1853 dumpCXXCtorInitializer(*I);
1891 OS <<
" unsafe_unretained";
1904 OS <<
" synthesize";
1911 void ASTDumper::VisitBlockDecl(
const BlockDecl *D) {
1916 dumpChild([=]{ OS <<
"..."; });
1919 dumpChild([=]{ OS <<
"capture this"; });
1921 for (
const auto &I : D->
captures()) {
1928 if (I.getVariable()) {
1930 dumpBareDeclRef(I.getVariable());
1932 if (I.hasCopyExpr())
1933 dumpStmt(I.getCopyExpr());
1943 void ASTDumper::dumpStmt(
const Stmt *S) {
1946 ColorScope Color(*
this, NullColor);
1952 if (
const DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
1957 VisitGenericSelectionExpr(GSE);
1968 void ASTDumper::VisitStmt(
const Stmt *
Node) {
1970 ColorScope Color(*
this, StmtColor);
1977 void ASTDumper::VisitDeclStmt(
const DeclStmt *Node) {
1985 void ASTDumper::VisitAttributedStmt(
const AttributedStmt *Node) {
1993 void ASTDumper::VisitLabelStmt(
const LabelStmt *Node) {
1995 OS <<
" '" << Node->
getName() <<
"'";
1998 void ASTDumper::VisitGotoStmt(
const GotoStmt *Node) {
2004 void ASTDumper::VisitCXXCatchStmt(
const CXXCatchStmt *Node) {
2009 void ASTDumper::VisitCapturedStmt(
const CapturedStmt *Node) {
2018 void ASTDumper::VisitOMPExecutableDirective(
2021 for (
auto *C : Node->
clauses()) {
2024 ColorScope Color(*
this, NullColor);
2025 OS <<
"<<<NULL>>> OMPClause";
2029 ColorScope Color(*
this, AttrColor);
2031 OS <<
"OMP" << ClauseName.substr(0, 1).upper()
2032 << ClauseName.drop_front() <<
"Clause";
2035 dumpSourceRange(
SourceRange(C->getLocStart(), C->getLocEnd()));
2036 if (C->isImplicit())
2037 OS <<
" <implicit>";
2038 for (
auto *S : C->children())
2048 void ASTDumper::VisitExpr(
const Expr *Node) {
2053 ColorScope Color(*
this, ValueKindColor);
2067 ColorScope Color(*
this, ObjectKindColor);
2075 OS <<
" objcproperty";
2078 OS <<
" objcsubscript";
2081 OS <<
" vectorcomponent";
2112 void ASTDumper::VisitCastExpr(
const CastExpr *Node) {
2116 ColorScope Color(*
this, CastColor);
2124 VisitCastExpr(Node);
2126 OS <<
" part_of_explicit_cast";
2129 void ASTDumper::VisitDeclRefExpr(
const DeclRefExpr *Node) {
2133 dumpBareDeclRef(Node->
getDecl());
2146 OS <<
"ADL) = '" << Node->
getName() <<
'\'';
2160 ColorScope Color(*
this, DeclKindNameColor);
2163 OS <<
"='" << *Node->
getDecl() <<
"'";
2166 OS <<
" isFreeIvar";
2169 void ASTDumper::VisitPredefinedExpr(
const PredefinedExpr *Node) {
2176 ColorScope Color(*
this, ValueColor);
2180 void ASTDumper::VisitIntegerLiteral(
const IntegerLiteral *Node) {
2184 ColorScope Color(*
this, ValueColor);
2185 OS <<
" " << Node->
getValue().toString(10, isSigned);
2191 ColorScope Color(*
this, ValueColor);
2197 ColorScope Color(*
this, ValueColor);
2201 void ASTDumper::VisitStringLiteral(
const StringLiteral *Str) {
2203 ColorScope Color(*
this, ValueColor);
2208 void ASTDumper::VisitInitListExpr(
const InitListExpr *ILE) {
2212 OS <<
"array filler";
2218 dumpBareDeclRef(Field);
2230 void ASTDumper::VisitUnaryOperator(
const UnaryOperator *Node) {
2232 OS <<
" " << (Node->
isPostfix() ?
"postfix" :
"prefix")
2235 OS <<
" cannot overflow";
2238 void ASTDumper::VisitUnaryExprOrTypeTraitExpr(
2252 OS <<
" __builtin_omp_required_simd_align";
2259 void ASTDumper::VisitMemberExpr(
const MemberExpr *Node) {
2270 void ASTDumper::VisitBinaryOperator(
const BinaryOperator *Node) {
2275 void ASTDumper::VisitCompoundAssignOperator(
2279 <<
"' ComputeLHSTy=";
2281 OS <<
" ComputeResultTy=";
2285 void ASTDumper::VisitBlockExpr(
const BlockExpr *Node) {
2300 OS <<
" result_dependent";
2304 for (
unsigned I = 0, N = E->
getNumAssocs(); I != N; ++I) {
2308 dumpType(TSI->getType());
2317 dumpTypeAsChild(TSI->getType());
2325 void ASTDumper::VisitAddrLabelExpr(
const AddrLabelExpr *Node) {
2346 OS <<
" " << (Node->
getValue() ?
"true" :
"false");
2349 void ASTDumper::VisitCXXThisExpr(
const CXXThisExpr *Node) {
2360 void ASTDumper::VisitCXXUnresolvedConstructExpr(
2377 OS <<
" std::initializer_list";
2388 void ASTDumper::VisitCXXNewExpr(
const CXXNewExpr *Node) {
2402 void ASTDumper::VisitCXXDeleteExpr(
const CXXDeleteExpr *Node) {
2418 OS <<
" extended by ";
2419 dumpBareDeclRef(VD);
2425 for (
unsigned i = 0, e = Node->
getNumObjects(); i != e; ++i)
2426 dumpDeclRef(Node->
getObject(i),
"cleanup");
2429 void ASTDumper::dumpCXXTemporary(
const CXXTemporary *Temporary) {
2430 OS <<
"(CXXTemporary";
2431 dumpPointer(Temporary);
2435 void ASTDumper::VisitSizeOfPackExpr(
const SizeOfPackExpr *Node) {
2441 dumpTemplateArgument(A);
2444 void ASTDumper::VisitCXXDependentScopeMemberExpr(
2468 OS <<
" super (instance)";
2472 OS <<
" super (class)";
2477 void ASTDumper::VisitObjCBoxedExpr(
const ObjCBoxedExpr *Node) {
2481 BoxingMethod->getSelector().print(OS);
2488 dumpDecl(CatchParam);
2493 void ASTDumper::VisitObjCEncodeExpr(
const ObjCEncodeExpr *Node) {
2514 OS <<
" Kind=MethodRef Getter=\"";
2520 OS <<
"\" Setter=\"";
2522 Setter->getSelector().print(OS);
2533 OS <<
" Messaging=";
2535 OS <<
"Getter&Setter";
2545 OS <<
" Kind=ArraySubscript GetterForArray=\"";
2547 OS <<
" Kind=DictionarySubscript GetterForDictionary=\"";
2554 OS <<
"\" SetterForArray=\"";
2556 OS <<
"\" SetterForDictionary=\"";
2565 OS <<
" " << (Node->
getValue() ?
"__objc_yes" :
"__objc_no");
2572 const char *ASTDumper::getCommandName(
unsigned CommandID) {
2578 return "<not a builtin command>";
2581 void ASTDumper::dumpFullComment(
const FullComment *C) {
2590 void ASTDumper::dumpComment(
const Comment *C) {
2593 ColorScope Color(*
this, NullColor);
2599 ColorScope Color(*
this, CommentColor);
2611 void ASTDumper::visitTextComment(
const TextComment *C) {
2612 OS <<
" Text=\"" << C->
getText() <<
"\"";
2616 OS <<
" Name=\"" << getCommandName(C->
getCommandID()) <<
"\"";
2619 OS <<
" RenderNormal";
2622 OS <<
" RenderBold";
2625 OS <<
" RenderMonospaced";
2628 OS <<
" RenderEmphasized";
2632 for (
unsigned i = 0, e = C->
getNumArgs(); i != e; ++i)
2633 OS <<
" Arg[" << i <<
"]=\"" << C->
getArgText(i) <<
"\"";
2640 for (
unsigned i = 0, e = C->
getNumAttrs(); i != e; ++i) {
2642 OS <<
" \"" << Attr.
Name <<
"=\"" << Attr.
Value <<
"\"";
2646 OS <<
" SelfClosing";
2654 OS <<
" Name=\"" << getCommandName(C->
getCommandID()) <<
"\"";
2655 for (
unsigned i = 0, e = C->
getNumArgs(); i != e; ++i)
2656 OS <<
" Arg[" << i <<
"]=\"" << C->
getArgText(i) <<
"\"";
2663 OS <<
" explicitly";
2665 OS <<
" implicitly";
2687 OS <<
" Position=<";
2688 for (
unsigned i = 0, e = C->
getDepth(); i != e; ++i) {
2698 OS <<
" Name=\"" << getCommandName(C->
getCommandID()) <<
"\"" 2702 void ASTDumper::visitVerbatimBlockLineComment(
2704 OS <<
" Text=\"" << C->
getText() <<
"\"";
2708 OS <<
" Text=\"" << C->
getText() <<
"\"";
2717 llvm::errs() << msg <<
": ";
2724 ASTDumper Dumper(OS,
nullptr,
nullptr);
2725 Dumper.dumpTypeAsChild(*
this);
2740 LLVM_DUMP_METHOD
void Decl::dump(raw_ostream &OS,
bool Deserialize)
const {
2745 P.setDeserialize(Deserialize);
2758 dumpLookups(llvm::errs());
2763 bool Deserialize)
const {
2767 ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
2771 P.setDeserialize(Deserialize);
2772 P.dumpLookups(
this, DumpDecls);
2780 dump(llvm::errs(), SM);
2784 ASTDumper
P(OS,
nullptr, &SM);
2789 ASTDumper
P(OS,
nullptr,
nullptr);
2794 ASTDumper
P(llvm::errs(),
nullptr,
nullptr);
2799 ASTDumper
P(llvm::errs(),
nullptr,
nullptr,
true);
2808 dump(llvm::errs(),
nullptr,
nullptr);
2819 ASTDumper D(OS, Traits, SM);
2820 D.dumpFullComment(FC);
2825 ASTDumper D(llvm::errs(),
nullptr,
nullptr,
true);
2826 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.
Represents 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
unsigned getResultIndex() const
The zero-based index of the result expression's generic association in the generic selection's associ...
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
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.
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.
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
Return true if this decl has its body fully specified.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
lookups_range noload_lookups(bool PreserveInternalState) const
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...
Represents 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 ...
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.
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
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 ...
bool isSpelledAsLValue() const
Represents a member of a struct/union/class.
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
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 Expr * getAssocExpr(unsigned i) const
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
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
bool isAnyMemberInitializer() const
const Expr * getInitExpr() const
DiagnosticsEngine & getDiagnostics() const
const Expr * getControllingExpr() 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.
lookups_range lookups() const
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...
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.
static bool canPassInRegisters(Sema &S, CXXRecordDecl *D, TargetInfo::CallingConvKind CCK)
Determine whether a type is permitted to be passed or returned in registers, per C++ [class...
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...
Represents the declaration of a typedef-name via a C++11 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...
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
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.
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.
const TypeSourceInfo * getAssocTypeSourceInfo(unsigned i) const
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.
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
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
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. ...
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.
std::string getValueAsString(unsigned Radix) const
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
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.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
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...
bool isPartOfExplicitCast() const
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)
Return the string used to specify the storage class SC.
Represents a C11 generic selection.
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.
unsigned getNumAssocs() const
Dataflow Directional Tag Classes.
bool isResultDependent() const
Whether this generic selection is result-dependent.
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...
Represents a field injected from an anonymous union/struct into the parent scope. ...
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.
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.
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
static const char * getCastKindName(CastKind CK)
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
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
Return the integer type this enum decl corresponds to.
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
StringRef getName() const
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.
This represents a decl that may have 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.
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.