llvm/clang/lib/AST/ASTImporter.cpp

//===- ASTImporter.cpp - Importing ASTs from other Contexts ---------------===//
//
// 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 defines the ASTImporter class which imports AST nodes from one
//  context into another context.
//
//===----------------------------------------------------------------------===//

#include "clang/AST/ASTImporter.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/ASTImporterSharedState.h"
#include "clang/AST/ASTStructuralEquivalence.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclAccessPair.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclGroup.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclVisitor.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/LambdaCapture.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/OperationKinds.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtObjC.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/TypeVisitor.h"
#include "clang/AST/UnresolvedSet.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/ExceptionSpecificationType.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Specifiers.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <memory>
#include <optional>
#include <type_traits>
#include <utility>

namespace clang {

  make_error;
  Error;
  Expected;
  ExpectedTypePtr;
  ExpectedType;
  ExpectedStmt;
  ExpectedExpr;
  ExpectedDecl;
  ExpectedSLoc;
  ExpectedName;

  std::string ASTImportError::toString() const {}

  void ASTImportError::log(raw_ostream &OS) const {}

  std::error_code ASTImportError::convertToErrorCode() const {}

  char ASTImportError::ID;

  template <class T>
  SmallVector<Decl *, 2>
  getCanonicalForwardRedeclChain(Redeclarable<T>* D) {}

  SmallVector<Decl*, 2> getCanonicalForwardRedeclChain(Decl* D) {}

  void updateFlags(const Decl *From, Decl *To) {}

  /// How to handle import errors that occur when import of a child declaration
  /// of a DeclContext fails.
  class ChildErrorHandlingStrategy {};

  class ASTNodeImporter : public TypeVisitor<ASTNodeImporter, ExpectedType>,
                          public DeclVisitor<ASTNodeImporter, ExpectedDecl>,
                          public StmtVisitor<ASTNodeImporter, ExpectedStmt> {};

template <typename InContainerTy>
Error ASTNodeImporter::ImportTemplateArgumentListInfo(
    SourceLocation FromLAngleLoc, SourceLocation FromRAngleLoc,
    const InContainerTy &Container, TemplateArgumentListInfo &Result) {}

template <>
Error ASTNodeImporter::ImportTemplateArgumentListInfo<TemplateArgumentListInfo>(
    const TemplateArgumentListInfo &From, TemplateArgumentListInfo &Result) {}

template <>
Error ASTNodeImporter::ImportTemplateArgumentListInfo<
    ASTTemplateArgumentListInfo>(
        const ASTTemplateArgumentListInfo &From,
        TemplateArgumentListInfo &Result) {}

Expected<ASTNodeImporter::FunctionTemplateAndArgsTy>
ASTNodeImporter::ImportFunctionTemplateWithTemplateArgsFromSpecialization(
    FunctionDecl *FromFD) {}

template <>
Expected<TemplateParameterList *>
ASTNodeImporter::import(TemplateParameterList *From) {}

template <>
Expected<TemplateArgument>
ASTNodeImporter::import(const TemplateArgument &From) {}

template <>
Expected<TemplateArgumentLoc>
ASTNodeImporter::import(const TemplateArgumentLoc &TALoc) {}

template <>
Expected<DeclGroupRef> ASTNodeImporter::import(const DeclGroupRef &DG) {}

template <>
Expected<ASTNodeImporter::Designator>
ASTNodeImporter::import(const Designator &D) {}

template <>
Expected<ConceptReference *> ASTNodeImporter::import(ConceptReference *From) {}

template <>
Expected<LambdaCapture> ASTNodeImporter::import(const LambdaCapture &From) {}

template <typename T>
bool ASTNodeImporter::hasSameVisibilityContextAndLinkage(T *Found, T *From) {}

template <>
bool ASTNodeImporter::hasSameVisibilityContextAndLinkage(TypedefNameDecl *Found,
                                               TypedefNameDecl *From) {}

} // namespace clang

//----------------------------------------------------------------------------
// Import Types
//----------------------------------------------------------------------------

usingnamespaceclang;

ExpectedType ASTNodeImporter::VisitType(const Type *T) {}

ExpectedType ASTNodeImporter::VisitAtomicType(const AtomicType *T){}

ExpectedType ASTNodeImporter::VisitBuiltinType(const BuiltinType *T) {}

ExpectedType ASTNodeImporter::VisitDecayedType(const DecayedType *T) {}

ExpectedType ASTNodeImporter::VisitComplexType(const ComplexType *T) {}

ExpectedType ASTNodeImporter::VisitPointerType(const PointerType *T) {}

ExpectedType ASTNodeImporter::VisitBlockPointerType(const BlockPointerType *T) {}

ExpectedType
ASTNodeImporter::VisitLValueReferenceType(const LValueReferenceType *T) {}

ExpectedType
ASTNodeImporter::VisitRValueReferenceType(const RValueReferenceType *T) {}

ExpectedType
ASTNodeImporter::VisitMemberPointerType(const MemberPointerType *T) {}

ExpectedType
ASTNodeImporter::VisitConstantArrayType(const ConstantArrayType *T) {}

ExpectedType
ASTNodeImporter::VisitArrayParameterType(const ArrayParameterType *T) {}

ExpectedType
ASTNodeImporter::VisitIncompleteArrayType(const IncompleteArrayType *T) {}

ExpectedType
ASTNodeImporter::VisitVariableArrayType(const VariableArrayType *T) {}

ExpectedType ASTNodeImporter::VisitDependentSizedArrayType(
    const DependentSizedArrayType *T) {}

ExpectedType ASTNodeImporter::VisitDependentSizedExtVectorType(
    const DependentSizedExtVectorType *T) {}

ExpectedType ASTNodeImporter::VisitVectorType(const VectorType *T) {}

ExpectedType ASTNodeImporter::VisitExtVectorType(const ExtVectorType *T) {}

ExpectedType
ASTNodeImporter::VisitFunctionNoProtoType(const FunctionNoProtoType *T) {}

ExpectedType
ASTNodeImporter::VisitFunctionProtoType(const FunctionProtoType *T) {}

ExpectedType ASTNodeImporter::VisitUnresolvedUsingType(
    const UnresolvedUsingType *T) {}

ExpectedType ASTNodeImporter::VisitParenType(const ParenType *T) {}

ExpectedType
ASTNodeImporter::VisitPackIndexingType(clang::PackIndexingType const *T) {}

ExpectedType ASTNodeImporter::VisitTypedefType(const TypedefType *T) {}

ExpectedType ASTNodeImporter::VisitTypeOfExprType(const TypeOfExprType *T) {}

ExpectedType ASTNodeImporter::VisitTypeOfType(const TypeOfType *T) {}

ExpectedType ASTNodeImporter::VisitUsingType(const UsingType *T) {}

ExpectedType ASTNodeImporter::VisitDecltypeType(const DecltypeType *T) {}

ExpectedType
ASTNodeImporter::VisitUnaryTransformType(const UnaryTransformType *T) {}

ExpectedType ASTNodeImporter::VisitAutoType(const AutoType *T) {}

ExpectedType ASTNodeImporter::VisitDeducedTemplateSpecializationType(
    const DeducedTemplateSpecializationType *T) {}

ExpectedType ASTNodeImporter::VisitInjectedClassNameType(
    const InjectedClassNameType *T) {}

ExpectedType ASTNodeImporter::VisitRecordType(const RecordType *T) {}

ExpectedType ASTNodeImporter::VisitEnumType(const EnumType *T) {}

ExpectedType ASTNodeImporter::VisitAttributedType(const AttributedType *T) {}

ExpectedType
ASTNodeImporter::VisitCountAttributedType(const CountAttributedType *T) {}

ExpectedType ASTNodeImporter::VisitTemplateTypeParmType(
    const TemplateTypeParmType *T) {}

ExpectedType ASTNodeImporter::VisitSubstTemplateTypeParmType(
    const SubstTemplateTypeParmType *T) {}

ExpectedType ASTNodeImporter::VisitSubstTemplateTypeParmPackType(
    const SubstTemplateTypeParmPackType *T) {}

ExpectedType ASTNodeImporter::VisitTemplateSpecializationType(
                                       const TemplateSpecializationType *T) {}

ExpectedType ASTNodeImporter::VisitElaboratedType(const ElaboratedType *T) {}

ExpectedType
ASTNodeImporter::VisitPackExpansionType(const PackExpansionType *T) {}

ExpectedType ASTNodeImporter::VisitDependentTemplateSpecializationType(
    const DependentTemplateSpecializationType *T) {}

ExpectedType
ASTNodeImporter::VisitDependentNameType(const DependentNameType *T) {}

ExpectedType
ASTNodeImporter::VisitObjCInterfaceType(const ObjCInterfaceType *T) {}

ExpectedType ASTNodeImporter::VisitObjCObjectType(const ObjCObjectType *T) {}

ExpectedType
ASTNodeImporter::VisitObjCObjectPointerType(const ObjCObjectPointerType *T) {}

ExpectedType
ASTNodeImporter::VisitMacroQualifiedType(const MacroQualifiedType *T) {}

ExpectedType clang::ASTNodeImporter::VisitAdjustedType(const AdjustedType *T) {}

ExpectedType clang::ASTNodeImporter::VisitBitIntType(const BitIntType *T) {}

ExpectedType clang::ASTNodeImporter::VisitBTFTagAttributedType(
    const clang::BTFTagAttributedType *T) {}

ExpectedType clang::ASTNodeImporter::VisitHLSLAttributedResourceType(
    const clang::HLSLAttributedResourceType *T) {}

ExpectedType clang::ASTNodeImporter::VisitConstantMatrixType(
    const clang::ConstantMatrixType *T) {}

ExpectedType clang::ASTNodeImporter::VisitDependentAddressSpaceType(
    const clang::DependentAddressSpaceType *T) {}

ExpectedType clang::ASTNodeImporter::VisitDependentBitIntType(
    const clang::DependentBitIntType *T) {}

ExpectedType clang::ASTNodeImporter::VisitDependentSizedMatrixType(
    const clang::DependentSizedMatrixType *T) {}

ExpectedType clang::ASTNodeImporter::VisitDependentVectorType(
    const clang::DependentVectorType *T) {}

ExpectedType clang::ASTNodeImporter::VisitObjCTypeParamType(
    const clang::ObjCTypeParamType *T) {}

ExpectedType clang::ASTNodeImporter::VisitPipeType(const clang::PipeType *T) {}

//----------------------------------------------------------------------------
// Import Declarations
//----------------------------------------------------------------------------
Error ASTNodeImporter::ImportDeclParts(
    NamedDecl *D, DeclContext *&DC, DeclContext *&LexicalDC,
    DeclarationName &Name, NamedDecl *&ToD, SourceLocation &Loc) {}

Error ASTNodeImporter::ImportDeclParts(NamedDecl *D, DeclarationName &Name,
                                       NamedDecl *&ToD, SourceLocation &Loc) {}

Error ASTNodeImporter::ImportDefinitionIfNeeded(Decl *FromD, Decl *ToD) {}

Error
ASTNodeImporter::ImportDeclarationNameLoc(
    const DeclarationNameInfo &From, DeclarationNameInfo& To) {}

Error
ASTNodeImporter::ImportDeclContext(DeclContext *FromDC, bool ForceImport) {}

Error ASTNodeImporter::ImportFieldDeclDefinition(const FieldDecl *From,
                                                 const FieldDecl *To) {}

Error ASTNodeImporter::ImportDeclContext(
    Decl *FromD, DeclContext *&ToDC, DeclContext *&ToLexicalDC) {}

Error ASTNodeImporter::ImportImplicitMethods(
    const CXXRecordDecl *From, CXXRecordDecl *To) {}

static Error setTypedefNameForAnonDecl(TagDecl *From, TagDecl *To,
                                       ASTImporter &Importer) {}

Error ASTNodeImporter::ImportDefinition(
    RecordDecl *From, RecordDecl *To, ImportDefinitionKind Kind) {}

Error ASTNodeImporter::ImportInitializer(VarDecl *From, VarDecl *To) {}

Error ASTNodeImporter::ImportDefinition(
    EnumDecl *From, EnumDecl *To, ImportDefinitionKind Kind) {}

Error ASTNodeImporter::ImportTemplateArguments(
    ArrayRef<TemplateArgument> FromArgs,
    SmallVectorImpl<TemplateArgument> &ToArgs) {}

// FIXME: Do not forget to remove this and use only 'import'.
Expected<TemplateArgument>
ASTNodeImporter::ImportTemplateArgument(const TemplateArgument &From) {}

template <typename InContainerTy>
Error ASTNodeImporter::ImportTemplateArgumentListInfo(
    const InContainerTy &Container, TemplateArgumentListInfo &ToTAInfo) {}

static StructuralEquivalenceKind
getStructuralEquivalenceKind(const ASTImporter &Importer) {}

bool ASTNodeImporter::IsStructuralMatch(Decl *From, Decl *To, bool Complain,
                                        bool IgnoreTemplateParmDepth) {}

ExpectedDecl ASTNodeImporter::VisitDecl(Decl *D) {}

ExpectedDecl ASTNodeImporter::VisitImportDecl(ImportDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitEmptyDecl(EmptyDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitTranslationUnitDecl(TranslationUnitDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitBindingDecl(BindingDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitAccessSpecDecl(AccessSpecDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitStaticAssertDecl(StaticAssertDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitNamespaceDecl(NamespaceDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {}

ExpectedDecl
ASTNodeImporter::VisitTypedefNameDecl(TypedefNameDecl *D, bool IsAlias) {}

ExpectedDecl ASTNodeImporter::VisitTypedefDecl(TypedefDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitTypeAliasDecl(TypeAliasDecl *D) {}

ExpectedDecl
ASTNodeImporter::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitLabelDecl(LabelDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitEnumDecl(EnumDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitRecordDecl(RecordDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitEnumConstantDecl(EnumConstantDecl *D) {}

template <typename DeclTy>
Error ASTNodeImporter::ImportTemplateParameterLists(const DeclTy *FromD,
                                                    DeclTy *ToD) {}

Error ASTNodeImporter::ImportTemplateInformation(
    FunctionDecl *FromFD, FunctionDecl *ToFD) {}

Expected<FunctionDecl *>
ASTNodeImporter::FindFunctionTemplateSpecialization(FunctionDecl *FromFD) {}

Error ASTNodeImporter::ImportFunctionDeclBody(FunctionDecl *FromFD,
                                              FunctionDecl *ToFD) {}

// Returns true if the given D has a DeclContext up to the TranslationUnitDecl
// which is equal to the given DC, or D is equal to DC.
static bool isAncestorDeclContextOf(const DeclContext *DC, const Decl *D) {}

// Check if there is a declaration that has 'DC' as parent context and is
// referenced from statement 'S' or one of its children. The search is done in
// BFS order through children of 'S'.
static bool isAncestorDeclContextOf(const DeclContext *DC, const Stmt *S) {}

namespace {
/// Check if a type has any reference to a declaration that is inside the body
/// of a function.
/// The \c CheckType(QualType) function should be used to determine
/// this property.
///
/// The type visitor visits one type object only (not recursive).
/// To find all referenced declarations we must discover all type objects until
/// the canonical type is reached (walk over typedef and similar objects). This
/// is done by loop over all "sugar" type objects. For every such type we must
/// check all declarations that are referenced from it. For this check the
/// visitor is used. In the visit functions all referenced declarations except
/// the one that follows in the sugar chain (if any) must be checked. For this
/// check the same visitor is re-used (it has no state-dependent data).
///
/// The visit functions have 3 possible return values:
///  - True, found a declaration inside \c ParentDC.
///  - False, found declarations only outside \c ParentDC and it is not possible
///    to find more declarations (the "sugar" chain does not continue).
///  - Empty optional value, found no declarations or only outside \c ParentDC,
///    but it is possible to find more declarations in the type "sugar" chain.
/// The loop over the "sugar" types can be implemented by using type visit
/// functions only (call \c CheckType with the desugared type). With the current
/// solution no visit function is needed if the type has only a desugared type
/// as data.
class IsTypeDeclaredInsideVisitor
    : public TypeVisitor<IsTypeDeclaredInsideVisitor, std::optional<bool>> {};
} // namespace

/// This function checks if the given function has a return type that contains
/// a reference (in any way) to a declaration inside the same function.
bool ASTNodeImporter::hasReturnTypeDeclaredInside(FunctionDecl *D) {}

ExplicitSpecifier
ASTNodeImporter::importExplicitSpecifier(Error &Err, ExplicitSpecifier ESpec) {}

ExpectedDecl ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitCXXMethodDecl(CXXMethodDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitCXXConstructorDecl(CXXConstructorDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitCXXDestructorDecl(CXXDestructorDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitCXXConversionDecl(CXXConversionDecl *D) {}

ExpectedDecl
ASTNodeImporter::VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitFieldDecl(FieldDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitIndirectFieldDecl(IndirectFieldDecl *D) {}

/// Used as return type of getFriendCountAndPosition.
struct FriendCountAndPosition {};

static bool IsEquivalentFriend(ASTImporter &Importer, FriendDecl *FD1,
                               FriendDecl *FD2) {}

static FriendCountAndPosition getFriendCountAndPosition(ASTImporter &Importer,
                                                        FriendDecl *FD) {}

ExpectedDecl ASTNodeImporter::VisitFriendDecl(FriendDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitObjCIvarDecl(ObjCIvarDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitVarDecl(VarDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitImplicitParamDecl(ImplicitParamDecl *D) {}

Error ASTNodeImporter::ImportDefaultArgOfParmVarDecl(
    const ParmVarDecl *FromParam, ParmVarDecl *ToParam) {}

Expected<InheritedConstructor>
ASTNodeImporter::ImportInheritedConstructor(const InheritedConstructor &From) {}

ExpectedDecl ASTNodeImporter::VisitParmVarDecl(ParmVarDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitObjCMethodDecl(ObjCMethodDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitObjCTypeParamDecl(ObjCTypeParamDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) {}

Error ASTNodeImporter::ImportDefinition(
    ObjCProtocolDecl *From, ObjCProtocolDecl *To, ImportDefinitionKind Kind) {}

ExpectedDecl ASTNodeImporter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {}

ExpectedDecl ASTNodeImporter::ImportUsingShadowDecls(BaseUsingDecl *D,
                                                     BaseUsingDecl *ToSI) {}

ExpectedDecl ASTNodeImporter::VisitUsingDecl(UsingDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitUsingEnumDecl(UsingEnumDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitUsingShadowDecl(UsingShadowDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitUsingPackDecl(UsingPackDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitUnresolvedUsingValueDecl(
    UnresolvedUsingValueDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitUnresolvedUsingTypenameDecl(
    UnresolvedUsingTypenameDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitBuiltinTemplateDecl(BuiltinTemplateDecl *D) {}

Error ASTNodeImporter::ImportDefinition(
    ObjCInterfaceDecl *From, ObjCInterfaceDecl *To, ImportDefinitionKind Kind) {}

Expected<ObjCTypeParamList *>
ASTNodeImporter::ImportObjCTypeParamList(ObjCTypeParamList *list) {}

ExpectedDecl ASTNodeImporter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {}

ExpectedDecl
ASTNodeImporter::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {}

ExpectedDecl
ASTNodeImporter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {}

ExpectedDecl
ASTNodeImporter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {}

ExpectedDecl
ASTNodeImporter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {}

ExpectedDecl
ASTNodeImporter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {}

ExpectedDecl
ASTNodeImporter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {}

// Returns the definition for a (forward) declaration of a TemplateDecl, if
// it has any definition in the redecl chain.
template <typename T> static auto getTemplateDefinition(T *D) -> T * {}

ExpectedDecl ASTNodeImporter::VisitClassTemplateDecl(ClassTemplateDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitClassTemplateSpecializationDecl(
                                          ClassTemplateSpecializationDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitVarTemplateDecl(VarTemplateDecl *D) {}

ExpectedDecl ASTNodeImporter::VisitVarTemplateSpecializationDecl(
    VarTemplateSpecializationDecl *D) {}

ExpectedDecl
ASTNodeImporter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {}

//----------------------------------------------------------------------------
// Import Statements
//----------------------------------------------------------------------------

ExpectedStmt ASTNodeImporter::VisitStmt(Stmt *S) {}


ExpectedStmt ASTNodeImporter::VisitGCCAsmStmt(GCCAsmStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitDeclStmt(DeclStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitNullStmt(NullStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitCompoundStmt(CompoundStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitCaseStmt(CaseStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitDefaultStmt(DefaultStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitLabelStmt(LabelStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitAttributedStmt(AttributedStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitIfStmt(IfStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitSwitchStmt(SwitchStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitWhileStmt(WhileStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitDoStmt(DoStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitForStmt(ForStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitGotoStmt(GotoStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitIndirectGotoStmt(IndirectGotoStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitContinueStmt(ContinueStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitBreakStmt(BreakStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitReturnStmt(ReturnStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitCXXCatchStmt(CXXCatchStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitCXXTryStmt(CXXTryStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitCXXForRangeStmt(CXXForRangeStmt *S) {}

ExpectedStmt
ASTNodeImporter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitObjCAtTryStmt(ObjCAtTryStmt *S) {}

ExpectedStmt
ASTNodeImporter::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitObjCAtThrowStmt(ObjCAtThrowStmt *S) {}

ExpectedStmt ASTNodeImporter::VisitObjCAutoreleasePoolStmt(
    ObjCAutoreleasePoolStmt *S) {}

//----------------------------------------------------------------------------
// Import Expressions
//----------------------------------------------------------------------------
ExpectedStmt ASTNodeImporter::VisitExpr(Expr *E) {}

ExpectedStmt ASTNodeImporter::VisitSourceLocExpr(SourceLocExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitVAArgExpr(VAArgExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitChooseExpr(ChooseExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitConvertVectorExpr(ConvertVectorExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitShuffleVectorExpr(ShuffleVectorExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitGNUNullExpr(GNUNullExpr *E) {}

ExpectedStmt
ASTNodeImporter::VisitGenericSelectionExpr(GenericSelectionExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitPredefinedExpr(PredefinedExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitDeclRefExpr(DeclRefExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitDesignatedInitExpr(DesignatedInitExpr *E) {}

ExpectedStmt
ASTNodeImporter::VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitIntegerLiteral(IntegerLiteral *E) {}


ExpectedStmt ASTNodeImporter::VisitFloatingLiteral(FloatingLiteral *E) {}

ExpectedStmt ASTNodeImporter::VisitImaginaryLiteral(ImaginaryLiteral *E) {}

ExpectedStmt ASTNodeImporter::VisitFixedPointLiteral(FixedPointLiteral *E) {}

ExpectedStmt ASTNodeImporter::VisitCharacterLiteral(CharacterLiteral *E) {}

ExpectedStmt ASTNodeImporter::VisitStringLiteral(StringLiteral *E) {}

ExpectedStmt ASTNodeImporter::VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitAtomicExpr(AtomicExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitAddrLabelExpr(AddrLabelExpr *E) {}
ExpectedStmt ASTNodeImporter::VisitConstantExpr(ConstantExpr *E) {}
ExpectedStmt ASTNodeImporter::VisitParenExpr(ParenExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitParenListExpr(ParenListExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitStmtExpr(StmtExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitUnaryOperator(UnaryOperator *E) {}

ExpectedStmt

ASTNodeImporter::VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitBinaryOperator(BinaryOperator *E) {}

ExpectedStmt ASTNodeImporter::VisitConditionalOperator(ConditionalOperator *E) {}

ExpectedStmt
ASTNodeImporter::VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXRewrittenBinaryOperator(
    CXXRewrittenBinaryOperator *E) {}

ExpectedStmt ASTNodeImporter::VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitExpressionTraitExpr(ExpressionTraitExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitOpaqueValueExpr(OpaqueValueExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {}

ExpectedStmt
ASTNodeImporter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {}

Expected<CXXCastPath>
ASTNodeImporter::ImportCastPath(CastExpr *CE) {}

ExpectedStmt ASTNodeImporter::VisitImplicitCastExpr(ImplicitCastExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitExplicitCastExpr(ExplicitCastExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitOffsetOfExpr(OffsetOfExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXThrowExpr(CXXThrowExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {}

ExpectedStmt
ASTNodeImporter::VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E) {}

ExpectedStmt
ASTNodeImporter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {}

ExpectedStmt

ASTNodeImporter::VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E) {}

ExpectedDecl ASTNodeImporter::VisitLifetimeExtendedTemporaryDecl(
    LifetimeExtendedTemporaryDecl *D) {}

ExpectedStmt
ASTNodeImporter::VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitPackExpansionExpr(PackExpansionExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitSizeOfPackExpr(SizeOfPackExpr *E) {}


ExpectedStmt ASTNodeImporter::VisitCXXNewExpr(CXXNewExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXDeleteExpr(CXXDeleteExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXConstructExpr(CXXConstructExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitExprWithCleanups(ExprWithCleanups *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXMemberCallExpr(CXXMemberCallExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXThisExpr(CXXThisExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitMemberExpr(MemberExpr *E) {}

ExpectedStmt
ASTNodeImporter::VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXDependentScopeMemberExpr(
    CXXDependentScopeMemberExpr *E) {}

ExpectedStmt
ASTNodeImporter::VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXUnresolvedConstructExpr(
    CXXUnresolvedConstructExpr *E) {}

ExpectedStmt
ASTNodeImporter::VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E) {}

ExpectedStmt
ASTNodeImporter::VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCallExpr(CallExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitLambdaExpr(LambdaExpr *E) {}


ExpectedStmt ASTNodeImporter::VisitInitListExpr(InitListExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXStdInitializerListExpr(
    CXXStdInitializerListExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXInheritedCtorInitExpr(
    CXXInheritedCtorInitExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitArrayInitLoopExpr(ArrayInitLoopExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitArrayInitIndexExpr(ArrayInitIndexExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXNamedCastExpr(CXXNamedCastExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitSubstNonTypeTemplateParmExpr(
    SubstNonTypeTemplateParmExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitTypeTraitExpr(TypeTraitExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXTypeidExpr(CXXTypeidExpr *E) {}

ExpectedStmt ASTNodeImporter::VisitCXXFoldExpr(CXXFoldExpr *E) {}

Error ASTNodeImporter::ImportOverriddenMethods(CXXMethodDecl *ToMethod,
                                               CXXMethodDecl *FromMethod) {}

ASTImporter::ASTImporter(ASTContext &ToContext, FileManager &ToFileManager,
                         ASTContext &FromContext, FileManager &FromFileManager,
                         bool MinimalImport,
                         std::shared_ptr<ASTImporterSharedState> SharedState)
    :{}

ASTImporter::~ASTImporter() = default;

std::optional<unsigned> ASTImporter::getFieldIndex(Decl *F) {}

ASTImporter::FoundDeclsTy
ASTImporter::findDeclsInToCtx(DeclContext *DC, DeclarationName Name) {}

void ASTImporter::AddToLookupTable(Decl *ToD) {}

Expected<Decl *> ASTImporter::ImportImpl(Decl *FromD) {}

void ASTImporter::RegisterImportedDecl(Decl *FromD, Decl *ToD) {}

llvm::Expected<ExprWithCleanups::CleanupObject>
ASTImporter::Import(ExprWithCleanups::CleanupObject From) {}

ExpectedTypePtr ASTImporter::Import(const Type *FromT) {}

Expected<QualType> ASTImporter::Import(QualType FromT) {}

Expected<TypeSourceInfo *> ASTImporter::Import(TypeSourceInfo *FromTSI) {}

namespace {
// To use this object, it should be created before the new attribute is created,
// and destructed after it is created. The construction already performs the
// import of the data.
template <typename T> struct AttrArgImporter {};

// To use this object, it should be created before the new attribute is created,
// and destructed after it is created. The construction already performs the
// import of the data. The array data is accessible in a pointer form, this form
// is used by the attribute classes. This object should be created once for the
// array data to be imported (the array size is not imported, just copied).
template <typename T> struct AttrArgArrayImporter {};

class AttrImporter {};
} // namespace

Expected<Attr *> ASTImporter::Import(const Attr *FromAttr) {}

Decl *ASTImporter::GetAlreadyImportedOrNull(const Decl *FromD) const {}

TranslationUnitDecl *ASTImporter::GetFromTU(Decl *ToD) {}

Expected<Decl *> ASTImporter::Import(Decl *FromD) {}

llvm::Expected<InheritedConstructor>
ASTImporter::Import(const InheritedConstructor &From) {}

Expected<DeclContext *> ASTImporter::ImportContext(DeclContext *FromDC) {}

Expected<Expr *> ASTImporter::Import(Expr *FromE) {}

Expected<Stmt *> ASTImporter::Import(Stmt *FromS) {}

Expected<NestedNameSpecifier *>
ASTImporter::Import(NestedNameSpecifier *FromNNS) {}

Expected<NestedNameSpecifierLoc>
ASTImporter::Import(NestedNameSpecifierLoc FromNNS) {}

Expected<TemplateName> ASTImporter::Import(TemplateName From) {}

Expected<SourceLocation> ASTImporter::Import(SourceLocation FromLoc) {}

Expected<SourceRange> ASTImporter::Import(SourceRange FromRange) {}

Expected<FileID> ASTImporter::Import(FileID FromID, bool IsBuiltin) {}

Expected<CXXCtorInitializer *> ASTImporter::Import(CXXCtorInitializer *From) {}

Expected<CXXBaseSpecifier *>
ASTImporter::Import(const CXXBaseSpecifier *BaseSpec) {}

llvm::Expected<APValue> ASTImporter::Import(const APValue &FromValue) {}

Error ASTImporter::ImportDefinition(Decl *From) {}

Expected<DeclarationName> ASTImporter::Import(DeclarationName FromName) {}

IdentifierInfo *ASTImporter::Import(const IdentifierInfo *FromId) {}

Expected<Selector> ASTImporter::Import(Selector FromSel) {}

llvm::Expected<APValue>
ASTNodeImporter::ImportAPValue(const APValue &FromValue) {}

Expected<DeclarationName> ASTImporter::HandleNameConflict(DeclarationName Name,
                                                          DeclContext *DC,
                                                          unsigned IDNS,
                                                          NamedDecl **Decls,
                                                          unsigned NumDecls) {}

DiagnosticBuilder ASTImporter::ToDiag(SourceLocation Loc, unsigned DiagID) {}

DiagnosticBuilder ASTImporter::FromDiag(SourceLocation Loc, unsigned DiagID) {}

void ASTImporter::CompleteDecl (Decl *D) {}

Decl *ASTImporter::MapImported(Decl *From, Decl *To) {}

std::optional<ASTImportError>
ASTImporter::getImportDeclErrorIfAny(Decl *FromD) const {}

void ASTImporter::setImportDeclError(Decl *From, ASTImportError Error) {}

bool ASTImporter::IsStructurallyEquivalent(QualType From, QualType To,
                                           bool Complain) {}