LLDB mainline
ClangExternalASTSourceCallbacks.h
Go to the documentation of this file.
1//===-- ClangExternalASTSourceCallbacks.h -----------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXTERNALASTSOURCECALLBACKS_H
10#define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXTERNALASTSOURCECALLBACKS_H
11
13#include "clang/Basic/Module.h"
14#include <optional>
15
16namespace lldb_private {
17
18class ClangExternalASTSourceCallbacks : public clang::ExternalASTSource {
19 /// LLVM RTTI support.
20 static char ID;
21
22public:
23 /// LLVM RTTI support.
24 bool isA(const void *ClassID) const override { return ClassID == &ID; }
25 static bool classof(const clang::ExternalASTSource *s) { return s->isA(&ID); }
26
28
30 const clang::DeclContext *DC,
31 llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
33
34 bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC,
35 clang::DeclarationName Name) override;
36
37 void CompleteType(clang::TagDecl *tag_decl) override;
38
39 void CompleteType(clang::ObjCInterfaceDecl *objc_decl) override;
40
42 const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
43 llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
44 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
45 &BaseOffsets,
46 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
47 &VirtualBaseOffsets) override;
48
49 TypeSystemClang &GetTypeSystem() const { return m_ast; }
50
51 /// Module-related methods.
52 /// \{
53 std::optional<clang::ASTSourceDescriptor>
54 getSourceDescriptor(unsigned ID) override;
55 clang::Module *getModule(unsigned ID) override;
56 OptionalClangModuleID RegisterModule(clang::Module *module);
57 OptionalClangModuleID GetIDForModule(clang::Module *module);
58 /// \}
59private:
61 std::vector<clang::Module *> m_modules;
62 llvm::DenseMap<clang::Module *, unsigned> m_ids;
63};
64
65} // namespace lldb_private
66
67#endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXTERNALASTSOURCECALLBACKS_H
static bool classof(const clang::ExternalASTSource *s)
bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC, clang::DeclarationName Name) override
OptionalClangModuleID RegisterModule(clang::Module *module)
std::optional< clang::ASTSourceDescriptor > getSourceDescriptor(unsigned ID) override
Module-related methods.
OptionalClangModuleID GetIDForModule(clang::Module *module)
bool isA(const void *ClassID) const override
LLVM RTTI support.
bool layoutRecordType(const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment, llvm::DenseMap< const clang::FieldDecl *, uint64_t > &FieldOffsets, llvm::DenseMap< const clang::CXXRecordDecl *, clang::CharUnits > &BaseOffsets, llvm::DenseMap< const clang::CXXRecordDecl *, clang::CharUnits > &VirtualBaseOffsets) override
void FindExternalLexicalDecls(const clang::DeclContext *DC, llvm::function_ref< bool(clang::Decl::Kind)> IsKindWeWant, llvm::SmallVectorImpl< clang::Decl * > &Result) override
llvm::DenseMap< clang::Module *, unsigned > m_ids
A TypeSystem implementation based on Clang.
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14