Path: blob/main/contrib/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
39654 views
//===-- ClangExternalASTSourceCallbacks.h -----------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXTERNALASTSOURCECALLBACKS_H9#define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXTERNALASTSOURCECALLBACKS_H1011#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"12#include "clang/Basic/ASTSourceDescriptor.h"13#include <optional>1415namespace clang {1617class Module;1819} // namespace clang2021namespace lldb_private {2223class ClangExternalASTSourceCallbacks : public clang::ExternalASTSource {24/// LLVM RTTI support.25static char ID;2627public:28/// LLVM RTTI support.29bool isA(const void *ClassID) const override { return ClassID == &ID; }30static bool classof(const clang::ExternalASTSource *s) { return s->isA(&ID); }3132ClangExternalASTSourceCallbacks(TypeSystemClang &ast) : m_ast(ast) {}3334void FindExternalLexicalDecls(35const clang::DeclContext *DC,36llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,37llvm::SmallVectorImpl<clang::Decl *> &Result) override;3839bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC,40clang::DeclarationName Name) override;4142void CompleteType(clang::TagDecl *tag_decl) override;4344void CompleteType(clang::ObjCInterfaceDecl *objc_decl) override;4546bool layoutRecordType(47const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,48llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,49llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>50&BaseOffsets,51llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>52&VirtualBaseOffsets) override;5354TypeSystemClang &GetTypeSystem() const { return m_ast; }5556/// Module-related methods.57/// \{58std::optional<clang::ASTSourceDescriptor>59getSourceDescriptor(unsigned ID) override;60clang::Module *getModule(unsigned ID) override;61OptionalClangModuleID RegisterModule(clang::Module *module);62OptionalClangModuleID GetIDForModule(clang::Module *module);63/// \}64private:65TypeSystemClang &m_ast;66std::vector<clang::Module *> m_modules;67llvm::DenseMap<clang::Module *, unsigned> m_ids;68};6970} // namespace lldb_private7172#endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXTERNALASTSOURCECALLBACKS_H737475