33 #include "llvm/Support/raw_ostream.h" 34 using namespace clang;
60 bool Deserialize =
false;
62 const bool ShowColors;
65 template<
typename Fn>
void dumpChild(Fn DoDumpChild) {
68 template <
typename Fn>
void dumpChild(StringRef
Label, Fn DoDumpChild) {
69 NodeDumper.
AddChild(Label, DoDumpChild);
75 : ASTDumper(OS, Traits, SM,
76 SM && SM->getDiagnostics().getShowColors()) {}
80 : ASTDumper(OS, Traits, SM, ShowColors,
LangOptions()) {}
84 : NodeDumper(OS, ShowColors, SM, PrintPolicy, Traits), OS(OS),
85 PrintPolicy(PrintPolicy), ShowColors(ShowColors) {}
87 void setDeserialize(
bool D) { Deserialize = D; }
89 void dumpDecl(
const Decl *D);
90 void dumpStmt(
const Stmt *S, StringRef Label = {});
94 void dumpTypeAsChild(
const Type *T);
96 void dumpLookups(
const DeclContext *DC,
bool DumpDecls);
97 void dumpAttr(
const Attr *A);
104 const Decl *From =
nullptr,
105 const char *Label =
nullptr);
109 const Decl *From =
nullptr,
110 const char *Label =
nullptr);
111 template <
typename SpecializationDecl>
112 void dumpTemplateDeclSpecialization(
const SpecializationDecl *D,
113 bool DumpExplicitInst,
115 template <
typename TemplateDecl>
116 void dumpTemplateDecl(
const TemplateDecl *D,
bool DumpExplicitInst);
141 void VisitArrayType(
const ArrayType *T) {
152 void VisitDependentSizedExtVectorType(
164 VisitFunctionType(T);
168 dumpChild([=] { OS <<
"..."; });
186 void VisitSubstTemplateTypeParmPackType(
193 dumpTemplateArgument(Arg);
194 if (T->isTypeAlias())
195 dumpTypeAsChild(T->getAliasedType());
203 void VisitPipeType(
const PipeType *T) {
219 void VisitEnumDecl(
const EnumDecl *D);
225 void VisitVarDecl(
const VarDecl *D);
250 void VisitClassTemplateSpecializationDecl(
252 void VisitClassTemplatePartialSpecializationDecl(
254 void VisitClassScopeFunctionSpecializationDecl(
258 void VisitVarTemplateSpecializationDecl(
260 void VisitVarTemplatePartialSpecializationDecl(
322 dumpTemplateArgument(TArg);
326 #include "clang/AST/AttrNodeTraverse.inc" 334 void ASTDumper::dumpTypeAsChild(
QualType T) {
337 return dumpTypeAsChild(SQT.
Ty);
345 void ASTDumper::dumpTypeAsChild(
const Type *T) {
354 if (SingleStepDesugar !=
QualType(T, 0))
355 dumpTypeAsChild(SingleStepDesugar);
359 void ASTDumper::dumpDeclContext(
const DeclContext *DC) {
369 OS <<
"<undeserialized declarations>";
374 void ASTDumper::dumpLookups(
const DeclContext *DC,
bool DumpDecls) {
376 OS <<
"StoredDeclsMap ";
387 auto Range = Deserialize
390 for (
auto I = Range.begin(), E = Range.end(); I != E; ++I) {
395 OS <<
"DeclarationName ";
398 OS <<
'\'' << Name <<
'\'';
406 if ((*RI)->isHidden())
412 std::function<void(Decl *)> DumpWithPrev = [&](
Decl *D) {
424 if (HasUndeserializedLookups) {
427 OS <<
"<undeserialized lookups>";
433 void ASTDumper::dumpAttr(
const Attr *A) {
446 NodeDumper.
Visit(Init);
460 void ASTDumper::dumpTemplateArgumentListInfo(
462 for (
unsigned i = 0, e = TALI.
size(); i < e; ++i)
463 dumpTemplateArgumentLoc(TALI[i]);
467 const Decl *From,
const char *Label) {
472 for (
unsigned i = 0, e = TAL.
size(); i < e; ++i)
473 dumpTemplateArgument(TAL[i]);
477 const Decl *From,
const char *Label) {
479 NodeDumper.
Visit(A, R, From, Label);
491 for (
auto typeParam : *typeParams) {
500 void ASTDumper::dumpDecl(
const Decl *D) {
517 if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D)) {
530 void ASTDumper::VisitTypedefDecl(
const TypedefDecl *D) {
534 OS <<
" __module_private__";
538 void ASTDumper::VisitEnumDecl(
const EnumDecl *D) {
547 OS <<
" __module_private__";
552 void ASTDumper::VisitRecordDecl(
const RecordDecl *D) {
556 OS <<
" __module_private__";
572 for (
auto *Child : D->
chain())
576 void ASTDumper::VisitFunctionDecl(
const FunctionDecl *D) {
588 OS <<
" __module_private__";
615 if (
const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
616 if (MD->size_overridden_methods() != 0) {
619 OS << D <<
" " << D->
getParent()->getName()
625 auto Overrides = MD->overridden_methods();
626 OS <<
"Overrides: [ ";
627 dumpOverride(*Overrides.begin());
628 for (
const auto *Override :
629 llvm::make_range(Overrides.begin() + 1, Overrides.end())) {
631 dumpOverride(Override);
639 dumpTemplateArgumentList(*FTSI->TemplateArguments);
642 dumpChild([=] { OS <<
"<<NULL params x " << D->
getNumParams() <<
">>"; });
647 if (
const auto *C = dyn_cast<CXXConstructorDecl>(D))
648 for (
const auto *I :
C->inits())
649 dumpCXXCtorInitializer(I);
655 void ASTDumper::VisitFieldDecl(
const FieldDecl *D) {
661 OS <<
" __module_private__";
669 void ASTDumper::VisitVarDecl(
const VarDecl *D) {
681 OS <<
" __module_private__";
704 void ASTDumper::VisitBindingDecl(
const BindingDecl *D) {
715 void ASTDumper::VisitImportDecl(
const ImportDecl *D) {
722 case PCK_Unknown: llvm_unreachable(
"unexpected pragma comment kind");
725 case PCK_Lib: OS <<
"lib";
break;
729 StringRef Arg = D->
getArg();
731 OS <<
" \"" << Arg <<
"\"";
734 void ASTDumper::VisitPragmaDetectMismatchDecl(
739 void ASTDumper::VisitCapturedDecl(
const CapturedDecl *D) {
758 OS <<
" initializer";
762 OS <<
" omp_priv = ";
765 OS <<
" omp_priv ()";
774 dumpStmt(Initializer);
782 OS <<
"<<<NULL>>> OMPClause";
788 OS <<
"OMP" << ClauseName.substr(0, 1).upper()
789 << ClauseName.drop_front() <<
"Clause";
845 OS <<
"DefinitionData";
847 #define FLAG(fn, name) if (D->fn()) OS << " " #name; 848 FLAG(isParsingBaseSpecifiers, parsing_base_specifiers);
850 FLAG(isGenericLambda,
generic);
851 FLAG(isLambda, lambda);
854 FLAG(isEmpty, empty);
855 FLAG(isAggregate, aggregate);
856 FLAG(isStandardLayout, standard_layout);
857 FLAG(isTriviallyCopyable, trivially_copyable);
860 FLAG(isPolymorphic, polymorphic);
861 FLAG(isAbstract,
abstract);
864 FLAG(hasUserDeclaredConstructor, has_user_declared_ctor);
865 FLAG(hasConstexprNonCopyMoveConstructor, has_constexpr_non_copy_move_ctor);
866 FLAG(hasMutableFields, has_mutable_fields);
867 FLAG(hasVariantMembers, has_variant_members);
868 FLAG(allowConstDefaultInit, can_const_default_init);
873 OS <<
"DefaultConstructor";
875 FLAG(hasDefaultConstructor, exists);
876 FLAG(hasTrivialDefaultConstructor, trivial);
877 FLAG(hasNonTrivialDefaultConstructor, non_trivial);
878 FLAG(hasUserProvidedDefaultConstructor, user_provided);
879 FLAG(hasConstexprDefaultConstructor, constexpr);
880 FLAG(needsImplicitDefaultConstructor, needs_implicit);
881 FLAG(defaultedDefaultConstructorIsConstexpr, defaulted_is_constexpr);
887 OS <<
"CopyConstructor";
889 FLAG(hasSimpleCopyConstructor, simple);
890 FLAG(hasTrivialCopyConstructor, trivial);
891 FLAG(hasNonTrivialCopyConstructor, non_trivial);
892 FLAG(hasUserDeclaredCopyConstructor, user_declared);
893 FLAG(hasCopyConstructorWithConstParam, has_const_param);
894 FLAG(needsImplicitCopyConstructor, needs_implicit);
895 FLAG(needsOverloadResolutionForCopyConstructor,
896 needs_overload_resolution);
898 FLAG(defaultedCopyConstructorIsDeleted, defaulted_is_deleted);
899 FLAG(implicitCopyConstructorHasConstParam, implicit_has_const_param);
905 OS <<
"MoveConstructor";
907 FLAG(hasMoveConstructor, exists);
908 FLAG(hasSimpleMoveConstructor, simple);
909 FLAG(hasTrivialMoveConstructor, trivial);
910 FLAG(hasNonTrivialMoveConstructor, non_trivial);
911 FLAG(hasUserDeclaredMoveConstructor, user_declared);
912 FLAG(needsImplicitMoveConstructor, needs_implicit);
913 FLAG(needsOverloadResolutionForMoveConstructor,
914 needs_overload_resolution);
916 FLAG(defaultedMoveConstructorIsDeleted, defaulted_is_deleted);
922 OS <<
"CopyAssignment";
924 FLAG(hasTrivialCopyAssignment, trivial);
925 FLAG(hasNonTrivialCopyAssignment, non_trivial);
926 FLAG(hasCopyAssignmentWithConstParam, has_const_param);
927 FLAG(hasUserDeclaredCopyAssignment, user_declared);
928 FLAG(needsImplicitCopyAssignment, needs_implicit);
929 FLAG(needsOverloadResolutionForCopyAssignment, needs_overload_resolution);
930 FLAG(implicitCopyAssignmentHasConstParam, implicit_has_const_param);
936 OS <<
"MoveAssignment";
938 FLAG(hasMoveAssignment, exists);
939 FLAG(hasSimpleMoveAssignment, simple);
940 FLAG(hasTrivialMoveAssignment, trivial);
941 FLAG(hasNonTrivialMoveAssignment, non_trivial);
942 FLAG(hasUserDeclaredMoveAssignment, user_declared);
943 FLAG(needsImplicitMoveAssignment, needs_implicit);
944 FLAG(needsOverloadResolutionForMoveAssignment, needs_overload_resolution);
952 FLAG(hasSimpleDestructor, simple);
953 FLAG(hasIrrelevantDestructor, irrelevant);
954 FLAG(hasTrivialDestructor, trivial);
955 FLAG(hasNonTrivialDestructor, non_trivial);
956 FLAG(hasUserDeclaredDestructor, user_declared);
957 FLAG(needsImplicitDestructor, needs_implicit);
958 FLAG(needsOverloadResolutionForDestructor, needs_overload_resolution);
960 FLAG(defaultedDestructorIsDeleted, defaulted_is_deleted);
964 for (
const auto &I : D->
bases()) {
970 if (I.isPackExpansion())
981 template <
typename SpecializationDecl>
982 void ASTDumper::dumpTemplateDeclSpecialization(
const SpecializationDecl *D,
983 bool DumpExplicitInst,
985 bool DumpedAny =
false;
986 for (
auto *RedeclWithBadType : D->redecls()) {
990 auto *Redecl = dyn_cast<SpecializationDecl>(RedeclWithBadType);
994 assert(isa<CXXRecordDecl>(RedeclWithBadType) &&
995 "expected an injected-class-name");
999 switch (Redecl->getTemplateSpecializationKind()) {
1002 if (!DumpExplicitInst)
1023 template <
typename TemplateDecl>
1024 void ASTDumper::dumpTemplateDecl(
const TemplateDecl *D,
bool DumpExplicitInst) {
1030 for (
auto *Child : D->specializations())
1031 dumpTemplateDeclSpecialization(Child, DumpExplicitInst,
1039 dumpTemplateDecl(D,
true);
1043 dumpTemplateDecl(D,
false);
1046 void ASTDumper::VisitClassTemplateSpecializationDecl(
1048 VisitCXXRecordDecl(D);
1052 void ASTDumper::VisitClassTemplatePartialSpecializationDecl(
1054 VisitClassTemplateSpecializationDecl(D);
1058 void ASTDumper::VisitClassScopeFunctionSpecializationDecl(
1066 dumpTemplateDecl(D,
false);
1074 void ASTDumper::VisitVarTemplateSpecializationDecl(
1080 void ASTDumper::VisitVarTemplatePartialSpecializationDecl(
1083 VisitVarTemplateSpecializationDecl(D);
1115 void ASTDumper::VisitTemplateTemplateParmDecl(
1123 dumpTemplateArgumentLoc(
1128 void ASTDumper::VisitUsingDecl(
const UsingDecl *D) {
1135 void ASTDumper::VisitUnresolvedUsingTypenameDecl(
1155 dumpTypeAsChild(TD->getTypeForDecl());
1158 void ASTDumper::VisitConstructorUsingShadowDecl(
1176 OS <<
"constructed ";
1195 void ASTDumper::VisitFriendDecl(
const FriendDecl *D) {
1206 void ASTDumper::VisitObjCIvarDecl(
const ObjCIvarDecl *D) {
1210 OS <<
" synthesize";
1243 dumpDecl(Parameter);
1247 dumpChild([=] { OS <<
"..."; });
1264 OS <<
" contravariant";
1314 dumpCXXCtorInitializer(*I);
1352 OS <<
" unsafe_unretained";
1365 OS <<
" synthesize";
1374 NodeDumper.
Visit(C);
1380 void ASTDumper::VisitBlockDecl(
const BlockDecl *D) {
1385 dumpChild([=]{ OS <<
"..."; });
1388 dumpChild([=]{ OS <<
"capture this"; });
1390 for (
const auto &I : D->
captures())
1399 void ASTDumper::dumpStmt(
const Stmt *S, StringRef Label) {
1400 dumpChild(Label, [=] {
1401 NodeDumper.
Visit(S);
1410 if (isa<DeclStmt>(S) || isa<GenericSelectionExpr>(S)) {
1419 void ASTDumper::VisitDeclStmt(
const DeclStmt *Node) {
1426 void ASTDumper::VisitAttributedStmt(
const AttributedStmt *Node) {
1433 void ASTDumper::VisitCXXCatchStmt(
const CXXCatchStmt *Node) {
1437 void ASTDumper::VisitCapturedStmt(
const CapturedStmt *Node) {
1445 void ASTDumper::Visit(
const OMPClause *C) {
1447 NodeDumper.
Visit(C);
1453 void ASTDumper::VisitOMPExecutableDirective(
1455 for (
const auto *C : Node->
clauses())
1464 void ASTDumper::VisitInitListExpr(
const InitListExpr *ILE) {
1466 dumpStmt(Filler,
"array_filler");
1470 void ASTDumper::VisitBlockExpr(
const BlockExpr *Node) {
1481 OS <<
" result_dependent";
1485 for (
unsigned I = 0, N = E->
getNumAssocs(); I != N; ++I) {
1489 NodeDumper.
dumpType(TSI->getType());
1498 dumpTypeAsChild(TSI->getType());
1508 void ASTDumper::VisitSizeOfPackExpr(
const SizeOfPackExpr *Node) {
1511 dumpTemplateArgument(A);
1520 dumpDecl(CatchParam);
1529 NodeDumper.
Visit(C, FC);
1536 dumpComment(*I, FC);
1546 llvm::errs() << msg <<
": ";
1553 ASTDumper Dumper(OS,
nullptr,
nullptr);
1554 Dumper.dumpTypeAsChild(*
this);
1569 LLVM_DUMP_METHOD
void Decl::dump(raw_ostream &OS,
bool Deserialize)
const {
1574 P.setDeserialize(Deserialize);
1587 dumpLookups(llvm::errs());
1592 bool Deserialize)
const {
1596 ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
1600 P.setDeserialize(Deserialize);
1601 P.dumpLookups(
this, DumpDecls);
1609 dump(llvm::errs(), SM);
1613 ASTDumper
P(OS,
nullptr, &SM);
1618 ASTDumper
P(OS,
nullptr,
nullptr);
1623 ASTDumper
P(llvm::errs(),
nullptr,
nullptr);
1628 ASTDumper
P(llvm::errs(),
nullptr,
nullptr,
true);
1637 dump(llvm::errs(),
nullptr,
nullptr);
1650 ASTDumper D(OS, Traits, SM);
1651 D.dumpComment(FC, FC);
1658 ASTDumper D(llvm::errs(),
nullptr,
nullptr,
true);
1659 D.dumpComment(FC, FC);
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.
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
Expr * getCopyExpr() const
A class which contains all the information about a particular captured value.
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getElementType() const
QualType getPointeeType() const
A (possibly-)qualified type.
ArrayRef< OMPClause * > clauses()
ObjCInterfaceDecl * getClassInterface()
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...
RetTy Visit(REF(TemplateArgument) TA, ParamTys... P)
Expr * getUnderlyingExpr() const
attr_iterator attr_begin() const
Stmt - This represents one statement.
Expr * getBitWidth() const
FunctionType - C99 6.7.5.3 - Function Declarators.
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.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
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.
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
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.
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
const DefArgStorage & getDefaultArgStorage() const
Declaration of a variable template.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Represent a C++ namespace.
RetTy Visit(const Type *T)
Performs the operation associated with this visitor object.
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 ...
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
void dumpSourceRange(SourceRange R)
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
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.
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.
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.
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.
Stores a list of template parameters for a TemplateDecl and its derived classes.
Describes how types, statements, expressions, and declarations should be printed. ...
protocol_range protocols() const
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
Represents a struct/union/class.
clauselist_range clauselists()
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)
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()
DeclGroupRef::const_iterator const_decl_iterator
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 parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
const DefArgStorage & getDefaultArgStorage() const
Represents a member of a struct/union/class.
A simple visitor class that helps create attribute visitors.
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.
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.
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
ArrayRef< ParmVarDecl * > parameters() const
Represents Objective-C's @catch statement.
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.
bool isBitField() const
Determines whether this field is a bitfield.
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
std::string getFullModuleName(bool AllowStringLiterals=false) const
Retrieve the full name of this module, including the path from its top-level module.
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
A simple visitor class that helps create template argument visitors.
PropertyAttributeKind getPropertyAttributes() const
Represents a typeof (or typeof) expression (a GCC extension).
const clang::PrintingPolicy & getPrintingPolicy() const
const Expr * getAssocExpr(unsigned i) const
const Type * getClass() 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...
static const TerminalColor DeclNameColor
Expr * getSizeExpr() const
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
const Expr * getInitExpr() const
DiagnosticsEngine & getDiagnostics() const
const Expr * getControllingExpr() const
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Represents an Objective-C protocol declaration.
lookups_range lookups() const
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
PropertyControl getPropertyImplementation() const
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
Represents the body of a CapturedStmt, and serves as its DeclContext.
Represents an ObjC class declaration.
Represents a linkage specification.
QualType getReturnType() const
void print(raw_ostream &OS, const PrintingPolicy &Policy, bool ResolveTemplateArguments=false) const
Print this nested name specifier to the given output stream.
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.
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()
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...
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Represents a prototype with parameter type info, e.g.
Holds a QualType and a TypeSourceInfo* that came out of a declarator parsing.
decl_range noload_decls() const
noload_decls_begin/end - Iterate over the declarations stored in this context that are currently load...
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
This represents '#pragma omp requires...' directive.
Represents an array type in C++ whose size is a value-dependent expression.
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.
This represents one expression.
StringRef getKindName() const
QualType getPointeeType() const
bool isDefaulted() const
Whether this function is defaulted per C++0x.
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Declaration of a template type parameter.
const TypeSourceInfo * getAssocTypeSourceInfo(unsigned i) const
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
VarDecl * getExceptionDecl() const
comments::CommandTraits & getCommentCommandTraits() const
ObjCInterfaceDecl * getSuperClass() const
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...
Represents the type decltype(expr) (C++11).
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...
StorageClass
Storage classes.
Direct list-initialization (C++11)
Qualifiers Quals
The local qualifiers.
Declaration of an alias template.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isInstanceMethod() const
Represents a GCC generic vector type.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
StringRef getName() const
std::string getAsString() const
This template specialization was implicitly instantiated from a template.
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
Expr * getUnderlyingExpr() const
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
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.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
This captures a statement into a function.
ExceptionSpecificationType Type
The kind of exception specification this is.
ExtProtoInfo getExtProtoInfo() const
bool isParameterPack() const
Returns whether this is a parameter pack.
bool getSynthesize() const
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.
void dumpPointer(const void *Ptr)
Pseudo declaration for capturing expressions.
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...
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
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.
C-style initialization with assignment.
This file defines OpenMP nodes for declarative directives.
bool isLiteral(TokenKind K)
Return true if this is a "literal" kind, like a numeric constant, string, etc.
ObjCCategoryDecl - Represents a category declaration.
This is a basic class for representing single OpenMP clause.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
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.
static const TerminalColor NullColor
decl_iterator decl_begin()
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
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.
void dumpDeclRef(const Decl *D, StringRef Label={})
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
const ParmDecl * getInheritedFrom() const
Get the parameter from which we inherit the default argument, if any.
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Represents a C++11 static_assert declaration.
decl_iterator noload_decls_end() const
ObjCImplementationDecl * getImplementation() const
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a pack expansion of types.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
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.
ast_type_traits::DynTypedNode Node
void dumpAccessSpecifier(AccessSpecifier AS)
TLS with a dynamic initializer.
Represents a template argument.
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.
TypeSourceInfo * getTypeSourceInfo() const
const TemplateArgument & getArgument() const
not evaluated yet, for special member function
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
static const TerminalColor AttrColor
bool hasExplicitTemplateArgs() const
ArrayRef< Capture > captures() const
The base class of all kinds of template declarations (e.g., class, function, etc.).
Kind getPropertyImplementation() const
ArrayRef< const Attr * > getAttrs() const
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.
Represents a dependent using declaration which was marked with typename.
The name of a declaration.
Represents the declaration of an Objective-C type parameter.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
const ObjCInterfaceDecl * getClassInterface() const
const DefArgStorage & getDefaultArgStorage() const
QualType getModifiedType() const
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...
void Visit(const comments::Comment *C, const comments::FullComment *FC)
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...
Complex values, per C99 6.2.5p11.
Location wrapper for a TemplateArgument.
Indicates that the tracking object is a descendant of a referenced-counted OSObject, used in the Darwin kernel.
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.
This template specialization was declared or defined by an explicit specialization (C++ [temp...
protocol_iterator protocol_begin() const
bool hasBody() const override
Determine whether this method has a body.
static const TerminalColor DeclKindNameColor
Base for LValueReferenceType and RValueReferenceType.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
SourceManager & getSourceManager()
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof...
bool capturesCXXThis() const
A template argument list.
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
An attributed type is a type to which a type attribute has been applied.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Call-style initialization (C++98)
void dumpName(const NamedDecl *ND)
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)...
bool isTrivial(const SExpr *E)
CXXCatchStmt - This represents a C++ catch block.
ObjCIvarDecl - Represents an ObjC instance variable.
void dumpBareDeclRef(const Decl *D)
Declaration of a class template.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
CXXMethodDecl * getSpecialization() const
protocol_iterator protocol_end() const
void dumpType(QualType T)
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.
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...
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
QualType getDefaultArgument() const
Retrieve the default argument, if any.
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...
ObjCMethodDecl * getGetterMethodDecl() const
CXXRecordDecl * getNominatedBaseClass() const
Get the base class that was named in the using declaration.
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.
AccessControl getAccessControl() const
Represents C++ using-directive.
Represents a #pragma detect_mismatch line.
A simple visitor class that helps create declaration visitors.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
This represents '#pragma omp threadprivate ...' directive.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
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.
void AddChild(Fn DoAddChild)
Add a child of the current node. Calls DoAddChild without arguments.
Attr - This represents one attribute.
bool isDeletedAsWritten() 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
static const TerminalColor UndeserializedColor
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.