llvm/clang/lib/AST/TextNodeDumper.cpp

//===--- TextNodeDumper.cpp - Printing of AST nodes -----------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements AST dumping of components of individual AST nodes.
//
//===----------------------------------------------------------------------===//

#include "clang/AST/TextNodeDumper.h"
#include "clang/AST/APValue.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclOpenMP.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/LocInfoType.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLocVisitor.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Specifiers.h"
#include "clang/Basic/TypeTraits.h"
#include "llvm/ADT/StringExtras.h"

#include <algorithm>
#include <utility>

usingnamespaceclang;

static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}

template <typename T>
static void dumpPreviousDeclImpl(raw_ostream &OS, const Mergeable<T> *D) {}

template <typename T>
static void dumpPreviousDeclImpl(raw_ostream &OS, const Redeclarable<T> *D) {}

/// Dump the previous declaration in the redeclaration chain for a declaration,
/// if any.
static void dumpPreviousDecl(raw_ostream &OS, const Decl *D) {}

TextNodeDumper::TextNodeDumper(raw_ostream &OS, const ASTContext &Context,
                               bool ShowColors)
    :{}

TextNodeDumper::TextNodeDumper(raw_ostream &OS, bool ShowColors)
    :{}

void TextNodeDumper::Visit(const comments::Comment *C,
                           const comments::FullComment *FC) {}

void TextNodeDumper::Visit(const Attr *A) {}

void TextNodeDumper::Visit(const TemplateArgument &TA, SourceRange R,
                           const Decl *From, StringRef Label) {}

void TextNodeDumper::Visit(const Stmt *Node) {}

void TextNodeDumper::Visit(const Type *T) {}

void TextNodeDumper::Visit(QualType T) {}

void TextNodeDumper::Visit(TypeLoc TL) {}

void TextNodeDumper::Visit(const Decl *D) {}

void TextNodeDumper::Visit(const CXXCtorInitializer *Init) {}

void TextNodeDumper::Visit(const BlockDecl::Capture &C) {}

void TextNodeDumper::Visit(const OMPClause *C) {}

void TextNodeDumper::Visit(const OpenACCClause *C) {}

void TextNodeDumper::Visit(const GenericSelectionExpr::ConstAssociation &A) {}

void TextNodeDumper::Visit(const ConceptReference *R) {}

void TextNodeDumper::Visit(const concepts::Requirement *R) {}

static double GetApproxValue(const llvm::APFloat &F) {}

/// True if the \p APValue \p Value can be folded onto the current line.
static bool isSimpleAPValue(const APValue &Value) {}

/// Dump the children of the \p APValue \p Value.
///
/// \param[in] Value          The \p APValue to visit
/// \param[in] Ty             The \p QualType passed to \p Visit
///
/// \param[in] IdxToChildFun  A function mapping an \p APValue and an index
///                           to one of the child of the \p APValue
///
/// \param[in] NumChildren    \p IdxToChildFun will be called on \p Value with
///                           the indices in the range \p [0,NumChildren(
///
/// \param[in] LabelSingular  The label to use on a line with a single child
/// \param[in] LabelPlurial   The label to use on a line with multiple children
void TextNodeDumper::dumpAPValueChildren(
    const APValue &Value, QualType Ty,
    const APValue &(*IdxToChildFun)(const APValue &, unsigned),
    unsigned NumChildren, StringRef LabelSingular, StringRef LabelPlurial) {}

void TextNodeDumper::Visit(const APValue &Value, QualType Ty) {}

void TextNodeDumper::dumpPointer(const void *Ptr) {}

void TextNodeDumper::dumpLocation(SourceLocation Loc) {}

void TextNodeDumper::dumpSourceRange(SourceRange R) {}

void TextNodeDumper::dumpBareType(QualType T, bool Desugar) {}

void TextNodeDumper::dumpType(QualType T) {}

void TextNodeDumper::dumpBareDeclRef(const Decl *D) {}

void TextNodeDumper::dumpName(const NamedDecl *ND) {}

void TextNodeDumper::dumpAccessSpecifier(AccessSpecifier AS) {}

void TextNodeDumper::dumpCleanupObject(
    const ExprWithCleanups::CleanupObject &C) {}

void clang::TextNodeDumper::dumpTemplateSpecializationKind(
    TemplateSpecializationKind TSK) {}

void clang::TextNodeDumper::dumpNestedNameSpecifier(const NestedNameSpecifier *NNS) {}

void TextNodeDumper::dumpDeclRef(const Decl *D, StringRef Label) {}

void TextNodeDumper::dumpTemplateArgument(const TemplateArgument &TA) {}

const char *TextNodeDumper::getCommandName(unsigned CommandID) {}

void TextNodeDumper::printFPOptions(FPOptionsOverride FPO) {}

void TextNodeDumper::visitTextComment(const comments::TextComment *C,
                                      const comments::FullComment *) {}

void TextNodeDumper::visitInlineCommandComment(
    const comments::InlineCommandComment *C, const comments::FullComment *) {}

void TextNodeDumper::visitHTMLStartTagComment(
    const comments::HTMLStartTagComment *C, const comments::FullComment *) {}

void TextNodeDumper::visitHTMLEndTagComment(
    const comments::HTMLEndTagComment *C, const comments::FullComment *) {}

void TextNodeDumper::visitBlockCommandComment(
    const comments::BlockCommandComment *C, const comments::FullComment *) {}

void TextNodeDumper::visitParamCommandComment(
    const comments::ParamCommandComment *C, const comments::FullComment *FC) {}

void TextNodeDumper::visitTParamCommandComment(
    const comments::TParamCommandComment *C, const comments::FullComment *FC) {}

void TextNodeDumper::visitVerbatimBlockComment(
    const comments::VerbatimBlockComment *C, const comments::FullComment *) {}

void TextNodeDumper::visitVerbatimBlockLineComment(
    const comments::VerbatimBlockLineComment *C,
    const comments::FullComment *) {}

void TextNodeDumper::visitVerbatimLineComment(
    const comments::VerbatimLineComment *C, const comments::FullComment *) {}

void TextNodeDumper::VisitNullTemplateArgument(const TemplateArgument &) {}

void TextNodeDumper::VisitTypeTemplateArgument(const TemplateArgument &TA) {}

void TextNodeDumper::VisitDeclarationTemplateArgument(
    const TemplateArgument &TA) {}

void TextNodeDumper::VisitNullPtrTemplateArgument(const TemplateArgument &TA) {}

void TextNodeDumper::VisitIntegralTemplateArgument(const TemplateArgument &TA) {}

void TextNodeDumper::dumpTemplateName(TemplateName TN, StringRef Label) {}

void TextNodeDumper::dumpBareTemplateName(TemplateName TN) {}

void TextNodeDumper::VisitTemplateTemplateArgument(const TemplateArgument &TA) {}

void TextNodeDumper::VisitTemplateExpansionTemplateArgument(
    const TemplateArgument &TA) {}

void TextNodeDumper::VisitExpressionTemplateArgument(
    const TemplateArgument &TA) {}

void TextNodeDumper::VisitPackTemplateArgument(const TemplateArgument &TA) {}

static void dumpBasePath(raw_ostream &OS, const CastExpr *Node) {}

void TextNodeDumper::VisitIfStmt(const IfStmt *Node) {}

void TextNodeDumper::VisitSwitchStmt(const SwitchStmt *Node) {}

void TextNodeDumper::VisitWhileStmt(const WhileStmt *Node) {}

void TextNodeDumper::VisitLabelStmt(const LabelStmt *Node) {}

void TextNodeDumper::VisitGotoStmt(const GotoStmt *Node) {}

void TextNodeDumper::VisitCaseStmt(const CaseStmt *Node) {}

void clang::TextNodeDumper::VisitReturnStmt(const ReturnStmt *Node) {}

void clang::TextNodeDumper::VisitCoawaitExpr(const CoawaitExpr *Node) {}

void clang::TextNodeDumper::VisitCoreturnStmt(const CoreturnStmt *Node) {}

void TextNodeDumper::VisitConstantExpr(const ConstantExpr *Node) {}

void TextNodeDumper::VisitCallExpr(const CallExpr *Node) {}

void TextNodeDumper::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *Node) {}

void TextNodeDumper::VisitCastExpr(const CastExpr *Node) {}

void TextNodeDumper::VisitImplicitCastExpr(const ImplicitCastExpr *Node) {}

void TextNodeDumper::VisitDeclRefExpr(const DeclRefExpr *Node) {}

void clang::TextNodeDumper::VisitDependentScopeDeclRefExpr(
    const DependentScopeDeclRefExpr *Node) {}

void TextNodeDumper::VisitUnresolvedLookupExpr(
    const UnresolvedLookupExpr *Node) {}

void TextNodeDumper::VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node) {}

void TextNodeDumper::VisitSYCLUniqueStableNameExpr(
    const SYCLUniqueStableNameExpr *Node) {}

void TextNodeDumper::VisitPredefinedExpr(const PredefinedExpr *Node) {}

void TextNodeDumper::VisitCharacterLiteral(const CharacterLiteral *Node) {}

void TextNodeDumper::VisitIntegerLiteral(const IntegerLiteral *Node) {}

void TextNodeDumper::VisitFixedPointLiteral(const FixedPointLiteral *Node) {}

void TextNodeDumper::VisitFloatingLiteral(const FloatingLiteral *Node) {}

void TextNodeDumper::VisitStringLiteral(const StringLiteral *Str) {}

void TextNodeDumper::VisitInitListExpr(const InitListExpr *ILE) {}

void TextNodeDumper::VisitGenericSelectionExpr(const GenericSelectionExpr *E) {}

void TextNodeDumper::VisitUnaryOperator(const UnaryOperator *Node) {}

void TextNodeDumper::VisitUnaryExprOrTypeTraitExpr(
    const UnaryExprOrTypeTraitExpr *Node) {}

void TextNodeDumper::VisitMemberExpr(const MemberExpr *Node) {}

void TextNodeDumper::VisitExtVectorElementExpr(
    const ExtVectorElementExpr *Node) {}

void TextNodeDumper::VisitBinaryOperator(const BinaryOperator *Node) {}

void TextNodeDumper::VisitCompoundAssignOperator(
    const CompoundAssignOperator *Node) {}

void TextNodeDumper::VisitAddrLabelExpr(const AddrLabelExpr *Node) {}

void TextNodeDumper::VisitCXXNamedCastExpr(const CXXNamedCastExpr *Node) {}

void TextNodeDumper::VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node) {}

void TextNodeDumper::VisitCXXThisExpr(const CXXThisExpr *Node) {}

void TextNodeDumper::VisitCXXFunctionalCastExpr(
    const CXXFunctionalCastExpr *Node) {}

void TextNodeDumper::VisitCXXStaticCastExpr(const CXXStaticCastExpr *Node) {}

void TextNodeDumper::VisitCXXUnresolvedConstructExpr(
    const CXXUnresolvedConstructExpr *Node) {}

void TextNodeDumper::VisitCXXConstructExpr(const CXXConstructExpr *Node) {}

void TextNodeDumper::VisitCXXBindTemporaryExpr(
    const CXXBindTemporaryExpr *Node) {}

void TextNodeDumper::VisitCXXNewExpr(const CXXNewExpr *Node) {}

void TextNodeDumper::VisitCXXDeleteExpr(const CXXDeleteExpr *Node) {}

void TextNodeDumper::VisitTypeTraitExpr(const TypeTraitExpr *Node) {}

void TextNodeDumper::VisitArrayTypeTraitExpr(const ArrayTypeTraitExpr *Node) {}

void TextNodeDumper::VisitExpressionTraitExpr(const ExpressionTraitExpr *Node) {}

void TextNodeDumper::VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *Node) {}

void TextNodeDumper::VisitCXXDefaultInitExpr(const CXXDefaultInitExpr *Node) {}

void TextNodeDumper::VisitMaterializeTemporaryExpr(
    const MaterializeTemporaryExpr *Node) {}

void TextNodeDumper::VisitExprWithCleanups(const ExprWithCleanups *Node) {}

void TextNodeDumper::VisitSizeOfPackExpr(const SizeOfPackExpr *Node) {}

void TextNodeDumper::VisitCXXDependentScopeMemberExpr(
    const CXXDependentScopeMemberExpr *Node) {}

void TextNodeDumper::VisitObjCMessageExpr(const ObjCMessageExpr *Node) {}

void TextNodeDumper::VisitObjCBoxedExpr(const ObjCBoxedExpr *Node) {}

void TextNodeDumper::VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node) {}

void TextNodeDumper::VisitObjCEncodeExpr(const ObjCEncodeExpr *Node) {}

void TextNodeDumper::VisitObjCSelectorExpr(const ObjCSelectorExpr *Node) {}

void TextNodeDumper::VisitObjCProtocolExpr(const ObjCProtocolExpr *Node) {}

void TextNodeDumper::VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *Node) {}

void TextNodeDumper::VisitObjCSubscriptRefExpr(
    const ObjCSubscriptRefExpr *Node) {}

void TextNodeDumper::VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node) {}

void TextNodeDumper::VisitOMPIteratorExpr(const OMPIteratorExpr *Node) {}

void TextNodeDumper::VisitConceptSpecializationExpr(
    const ConceptSpecializationExpr *Node) {}

void TextNodeDumper::VisitRequiresExpr(
    const RequiresExpr *Node) {}

void TextNodeDumper::VisitRValueReferenceType(const ReferenceType *T) {}

void TextNodeDumper::VisitArrayType(const ArrayType *T) {}

void TextNodeDumper::VisitConstantArrayType(const ConstantArrayType *T) {}

void TextNodeDumper::VisitVariableArrayType(const VariableArrayType *T) {}

void TextNodeDumper::VisitDependentSizedArrayType(
    const DependentSizedArrayType *T) {}

void TextNodeDumper::VisitDependentSizedExtVectorType(
    const DependentSizedExtVectorType *T) {}

void TextNodeDumper::VisitVectorType(const VectorType *T) {}

void TextNodeDumper::VisitFunctionType(const FunctionType *T) {}

void TextNodeDumper::VisitFunctionProtoType(const FunctionProtoType *T) {}

void TextNodeDumper::VisitUnresolvedUsingType(const UnresolvedUsingType *T) {}

void TextNodeDumper::VisitUsingType(const UsingType *T) {}

void TextNodeDumper::VisitTypedefType(const TypedefType *T) {}

void TextNodeDumper::VisitUnaryTransformType(const UnaryTransformType *T) {}

void TextNodeDumper::VisitTagType(const TagType *T) {}

void TextNodeDumper::VisitTemplateTypeParmType(const TemplateTypeParmType *T) {}

void TextNodeDumper::VisitSubstTemplateTypeParmType(
    const SubstTemplateTypeParmType *T) {}

void TextNodeDumper::VisitSubstTemplateTypeParmPackType(
    const SubstTemplateTypeParmPackType *T) {}

void TextNodeDumper::VisitAutoType(const AutoType *T) {}

void TextNodeDumper::VisitDeducedTemplateSpecializationType(
    const DeducedTemplateSpecializationType *T) {}

void TextNodeDumper::VisitTemplateSpecializationType(
    const TemplateSpecializationType *T) {}

void TextNodeDumper::VisitInjectedClassNameType(
    const InjectedClassNameType *T) {}

void TextNodeDumper::VisitObjCInterfaceType(const ObjCInterfaceType *T) {}

void TextNodeDumper::VisitPackExpansionType(const PackExpansionType *T) {}

void TextNodeDumper::VisitTypeLoc(TypeLoc TL) {}
// FIXME: override behavior for TypeLocs that have interesting location
// information, such as the qualifier in ElaboratedTypeLoc.

void TextNodeDumper::VisitLabelDecl(const LabelDecl *D) {}

void TextNodeDumper::VisitTypedefDecl(const TypedefDecl *D) {}

void TextNodeDumper::VisitEnumDecl(const EnumDecl *D) {}

void TextNodeDumper::VisitRecordDecl(const RecordDecl *D) {}

void TextNodeDumper::VisitEnumConstantDecl(const EnumConstantDecl *D) {}

void TextNodeDumper::VisitIndirectFieldDecl(const IndirectFieldDecl *D) {}

void TextNodeDumper::VisitFunctionDecl(const FunctionDecl *D) {}

void TextNodeDumper::VisitCXXDeductionGuideDecl(
    const CXXDeductionGuideDecl *D) {}

void TextNodeDumper::VisitLifetimeExtendedTemporaryDecl(
    const LifetimeExtendedTemporaryDecl *D) {}

void TextNodeDumper::VisitFieldDecl(const FieldDecl *D) {}

void TextNodeDumper::VisitVarDecl(const VarDecl *D) {}

void TextNodeDumper::VisitBindingDecl(const BindingDecl *D) {}

void TextNodeDumper::VisitCapturedDecl(const CapturedDecl *D) {}

void TextNodeDumper::VisitImportDecl(const ImportDecl *D) {}

void TextNodeDumper::VisitPragmaCommentDecl(const PragmaCommentDecl *D) {}

void TextNodeDumper::VisitPragmaDetectMismatchDecl(
    const PragmaDetectMismatchDecl *D) {}

void TextNodeDumper::VisitOMPExecutableDirective(
    const OMPExecutableDirective *D) {}

void TextNodeDumper::VisitOMPDeclareReductionDecl(
    const OMPDeclareReductionDecl *D) {}

void TextNodeDumper::VisitOMPRequiresDecl(const OMPRequiresDecl *D) {}

void TextNodeDumper::VisitOMPCapturedExprDecl(const OMPCapturedExprDecl *D) {}

void TextNodeDumper::VisitNamespaceDecl(const NamespaceDecl *D) {}

void TextNodeDumper::VisitUsingDirectiveDecl(const UsingDirectiveDecl *D) {}

void TextNodeDumper::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) {}

void TextNodeDumper::VisitTypeAliasDecl(const TypeAliasDecl *D) {}

void TextNodeDumper::VisitTypeAliasTemplateDecl(
    const TypeAliasTemplateDecl *D) {}

void TextNodeDumper::VisitCXXRecordDecl(const CXXRecordDecl *D) {}

void TextNodeDumper::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {}

void TextNodeDumper::VisitClassTemplateDecl(const ClassTemplateDecl *D) {}

void TextNodeDumper::VisitVarTemplateDecl(const VarTemplateDecl *D) {}

void TextNodeDumper::VisitBuiltinTemplateDecl(const BuiltinTemplateDecl *D) {}

void TextNodeDumper::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) {}

void TextNodeDumper::VisitNonTypeTemplateParmDecl(
    const NonTypeTemplateParmDecl *D) {}

void TextNodeDumper::VisitTemplateTemplateParmDecl(
    const TemplateTemplateParmDecl *D) {}

void TextNodeDumper::VisitUsingDecl(const UsingDecl *D) {}

void TextNodeDumper::VisitUsingEnumDecl(const UsingEnumDecl *D) {}

void TextNodeDumper::VisitUnresolvedUsingTypenameDecl(
    const UnresolvedUsingTypenameDecl *D) {}

void TextNodeDumper::VisitUnresolvedUsingValueDecl(
    const UnresolvedUsingValueDecl *D) {}

void TextNodeDumper::VisitUsingShadowDecl(const UsingShadowDecl *D) {}

void TextNodeDumper::VisitConstructorUsingShadowDecl(
    const ConstructorUsingShadowDecl *D) {}

void TextNodeDumper::VisitLinkageSpecDecl(const LinkageSpecDecl *D) {}

void TextNodeDumper::VisitAccessSpecDecl(const AccessSpecDecl *D) {}

void TextNodeDumper::VisitFriendDecl(const FriendDecl *D) {}

void TextNodeDumper::VisitObjCIvarDecl(const ObjCIvarDecl *D) {}

void TextNodeDumper::VisitObjCMethodDecl(const ObjCMethodDecl *D) {}

void TextNodeDumper::VisitObjCTypeParamDecl(const ObjCTypeParamDecl *D) {}

void TextNodeDumper::VisitObjCCategoryDecl(const ObjCCategoryDecl *D) {}

void TextNodeDumper::VisitObjCCategoryImplDecl(const ObjCCategoryImplDecl *D) {}

void TextNodeDumper::VisitObjCProtocolDecl(const ObjCProtocolDecl *D) {}

void TextNodeDumper::VisitObjCInterfaceDecl(const ObjCInterfaceDecl *D) {}

void TextNodeDumper::VisitObjCImplementationDecl(
    const ObjCImplementationDecl *D) {}

void TextNodeDumper::VisitObjCCompatibleAliasDecl(
    const ObjCCompatibleAliasDecl *D) {}

void TextNodeDumper::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) {}

void TextNodeDumper::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) {}

void TextNodeDumper::VisitBlockDecl(const BlockDecl *D) {}

void TextNodeDumper::VisitConceptDecl(const ConceptDecl *D) {}

void TextNodeDumper::VisitCompoundStmt(const CompoundStmt *S) {}

void TextNodeDumper::VisitHLSLBufferDecl(const HLSLBufferDecl *D) {}

void TextNodeDumper::VisitHLSLOutArgExpr(const HLSLOutArgExpr *E) {}

void TextNodeDumper::VisitOpenACCConstructStmt(const OpenACCConstructStmt *S) {}
void TextNodeDumper::VisitOpenACCLoopConstruct(const OpenACCLoopConstruct *S) {}

void TextNodeDumper::VisitEmbedExpr(const EmbedExpr *S) {}

void TextNodeDumper::VisitAtomicExpr(const AtomicExpr *AE) {}