[compiler-rt][rtsan] inotify api for Linux interception. (#124177)
[llvm-project.git] / lldb / source / Plugins / ExpressionParser / Clang / ClangExternalASTSourceCallbacks.h
blobd0eabb509455c1312d3cbb3bba029fb4f789697f
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 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXTERNALASTSOURCECALLBACKS_H
10 #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXTERNALASTSOURCECALLBACKS_H
12 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
13 #include "clang/Basic/ASTSourceDescriptor.h"
14 #include <optional>
16 namespace clang {
18 class Module;
20 } // namespace clang
22 namespace lldb_private {
24 class ClangExternalASTSourceCallbacks : public clang::ExternalASTSource {
25 /// LLVM RTTI support.
26 static char ID;
28 public:
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); }
33 ClangExternalASTSourceCallbacks(TypeSystemClang &ast) : m_ast(ast) {}
35 void FindExternalLexicalDecls(
36 const clang::DeclContext *DC,
37 llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
38 llvm::SmallVectorImpl<clang::Decl *> &Result) override;
40 bool
41 FindExternalVisibleDeclsByName(const clang::DeclContext *DC,
42 clang::DeclarationName Name,
43 const clang::DeclContext *OriginalDC) override;
45 void CompleteType(clang::TagDecl *tag_decl) override;
47 void CompleteType(clang::ObjCInterfaceDecl *objc_decl) override;
49 bool layoutRecordType(
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;
57 TypeSystemClang &GetTypeSystem() const { return m_ast; }
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 /// \}
67 private:
68 TypeSystemClang &m_ast;
69 std::vector<clang::Module *> m_modules;
70 llvm::DenseMap<clang::Module *, unsigned> m_ids;
73 } // namespace lldb_private
75 #endif // LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXTERNALASTSOURCECALLBACKS_H