//===-- CxxModuleHandler.cpp ----------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// #include "Plugins/ExpressionParser/Clang/CxxModuleHandler.h" #include "Plugins/TypeSystem/Clang/TypeSystemClang.h" #include "lldb/Utility/LLDBLog.h" #include "lldb/Utility/Log.h" #include "clang/Sema/Lookup.h" #include "llvm/Support/Error.h" #include <optional> usingnamespacelldb_private; usingnamespaceclang; CxxModuleHandler::CxxModuleHandler(ASTImporter &importer, ASTContext *target) : … { … } /// Builds a list of scopes that point into the given context. /// /// \param sema The sema that will be using the scopes. /// \param ctxt The context that the scope should look into. /// \param result A list of scopes. The scopes need to be freed by the caller /// (except the TUScope which is owned by the sema). static void makeScopes(Sema &sema, DeclContext *ctxt, std::vector<Scope *> &result) { … } /// Uses the Sema to look up the given name in the given DeclContext. static std::unique_ptr<LookupResult> emulateLookupInCtxt(Sema &sema, llvm::StringRef name, DeclContext *ctxt) { … } /// Error class for handling problems when finding a certain DeclContext. struct MissingDeclContext : public llvm::ErrorInfo<MissingDeclContext> { … }; char MissingDeclContext::ID = …; /// Given a foreign decl context, this function finds the equivalent local /// decl context in the ASTContext of the given Sema. Potentially deserializes /// decls from the 'std' module if necessary. static llvm::Expected<DeclContext *> getEqualLocalDeclContext(Sema &sema, DeclContext *foreign_ctxt) { … } /// Returns true iff tryInstantiateStdTemplate supports instantiating a template /// with the given template arguments. static bool templateArgsAreSupported(ArrayRef<TemplateArgument> a) { … } /// Constructor function for Clang declarations. Ensures that the created /// declaration is registered with the ASTImporter. template <typename T, typename... Args> T *createDecl(ASTImporter &importer, Decl *from_d, Args &&... args) { … } std::optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) { … } std::optional<Decl *> CxxModuleHandler::Import(Decl *d) { … }