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/ASTSourceDescriptor.h"
14#include <optional>
15
16namespace clang {
17
18class Module;
19
20} // namespace clang
21
22namespace lldb_private {
23
24class ClangExternalASTSourceCallbacks : public clang::ExternalASTSource {
25 /// LLVM RTTI support.
26 static char ID;
27
28public:
29 /// LLVM RTTI support.
30 bool isA(const void *ClassID) const override { return ClassID == &ID; }
31 static bool classof(const clang::ExternalASTSource *s) { return s->isA(&ID); }
32
34
36 const clang::DeclContext *DC,
37 llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
39
40 bool
41 FindExternalVisibleDeclsByName(const clang::DeclContext *DC,
42 clang::DeclarationName Name,
43 const clang::DeclContext *OriginalDC) override;
44
45 void CompleteType(clang::TagDecl *tag_decl) override;
46
47 void CompleteType(clang::ObjCInterfaceDecl *objc_decl) override;
48
50 const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
51 llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
52 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
53 &BaseOffsets,
54 llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
55 &VirtualBaseOffsets) override;
56
57 TypeSystemClang &GetTypeSystem() const { return m_ast; }
58
59 /// Module-related methods.
60 /// \{
61 std::optional<clang::ASTSourceDescriptor>
62 getSourceDescriptor(unsigned ID) override;
63 clang::Module *getModule(unsigned ID) override;
64 OptionalClangModuleID RegisterModule(clang::Module *module);
65 OptionalClangModuleID GetIDForModule(clang::Module *module);
66 /// \}
67private:
69 std::vector<clang::Module *> m_modules;
70 llvm::DenseMap<clang::Module *, unsigned> m_ids;
71};
72
73} // namespace lldb_private
74
75#endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXTERNALASTSOURCECALLBACKS_H
bool FindExternalVisibleDeclsByName(const clang::DeclContext *DC, clang::DeclarationName Name, const clang::DeclContext *OriginalDC) override
static bool classof(const clang::ExternalASTSource *s)
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.