[Lldb-commits] [clang] [lldb] [clang][Modules] Move `ASTSourceDescriptor` into its own file (PR #67930)
davidstone wrote: Could I get someone to merge this for me if there are no other changes required? https://github.com/llvm/llvm-project/pull/67930 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [libcxx] [lldb] [llvm] Add clang basic module directory (PR #93388)
davidstone wrote: To give a little more detail about my plans as of right now: * Move `VisibleModuleSet` into its own file * Move `ASTFileSignature` into its own file * Take some of the related members of `Module`, group them together into their own class, and move the resulting classes into their own headers That last one is the most vague, because until I actually do some of the work I won't really know what the proper divisions are. But even if that last bullet ends up being two things split out, the `Module` directory ends up with 6 files in it, which is a much more reasonable organizational structure than the 2 files in this commit. https://github.com/llvm/llvm-project/pull/93388 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [libcxx] [lldb] [llvm] Add clang basic module directory (PR #93388)
davidstone wrote: > I don't like the PR since I don't feel it makes the code cleaner and it may > make the downstream suffering backporting. > > If there are deeper reasons or following patches, we can discuss them > seperately. On its own, I would agree. My goal is to split several more things out of `Module.h` but still keep all the module things together. I'm fine letting this sit until I get some of those other changes together and we can look over a broader set of changes and see if the direction is good. https://github.com/llvm/llvm-project/pull/93388 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [libcxx] [lldb] [llvm] Add clang basic module directory (PR #93388)
https://github.com/davidstone edited https://github.com/llvm/llvm-project/pull/93388 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [libcxx] [lldb] [llvm] Add clang basic module directory (PR #93388)
https://github.com/davidstone updated https://github.com/llvm/llvm-project/pull/93388 >From f4b9852b0c11a9b5087c5fdb7794b5cab7f4d22c Mon Sep 17 00:00:00 2001 From: David Stone Date: Sun, 26 May 2024 10:34:09 -0600 Subject: [PATCH 1/3] [clang][Modules] Remove unnecessary includes of `Module.h` --- .../clangd/unittests/ReplayPeambleTests.cpp | 10 +- .../include/clang/APINotes/APINotesManager.h | 5 +- .../Serialization/SymbolGraphSerializer.h | 1 - clang/include/clang/Serialization/ASTWriter.h | 32 ++--- .../clang/Serialization/ModuleManager.h | 14 +- clang/lib/APINotes/APINotesManager.cpp| 1 + clang/lib/AST/ASTDumper.cpp | 12 +- clang/lib/CodeGen/CodeGenModule.h | 126 -- clang/lib/ExtractAPI/API.cpp | 1 - .../header_exportable_declarations.cpp| 2 - 10 files changed, 93 insertions(+), 111 deletions(-) diff --git a/clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp b/clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp index 147d9abe69137..32942e6bbfdc8 100644 --- a/clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp +++ b/clang-tools-extra/clangd/unittests/ReplayPeambleTests.cpp @@ -25,7 +25,6 @@ #include "clang/AST/DeclTemplate.h" #include "clang/Basic/FileEntry.h" #include "clang/Basic/LLVM.h" -#include "clang/Basic/Module.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/TokenKinds.h" @@ -42,7 +41,11 @@ #include #include -namespace clang::clangd { +namespace clang { + +class Module; + +namespace clangd { namespace { struct Inclusion { Inclusion(const SourceManager , SourceLocation HashLoc, @@ -170,4 +173,5 @@ TEST(ReplayPreambleTest, IncludesAndSkippedFiles) { } } } // namespace -} // namespace clang::clangd +} // namespace clangd +} // namespace clang diff --git a/clang/include/clang/APINotes/APINotesManager.h b/clang/include/clang/APINotes/APINotesManager.h index 18375c9e51a17..40c6328319dbd 100644 --- a/clang/include/clang/APINotes/APINotesManager.h +++ b/clang/include/clang/APINotes/APINotesManager.h @@ -9,7 +9,6 @@ #ifndef LLVM_CLANG_APINOTES_APINOTESMANAGER_H #define LLVM_CLANG_APINOTES_APINOTESMANAGER_H -#include "clang/Basic/Module.h" #include "clang/Basic/SourceLocation.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" @@ -24,6 +23,7 @@ namespace clang { class DirectoryEntry; class FileEntry; class LangOptions; +class Module; class SourceManager; namespace api_notes { @@ -159,7 +159,8 @@ class APINotesManager { ArrayRef getCurrentModuleReaders() const { bool HasPublic = CurrentModuleReaders[ReaderKind::Public]; bool HasPrivate = CurrentModuleReaders[ReaderKind::Private]; -assert((!HasPrivate || HasPublic) && "private module requires public module"); +assert((!HasPrivate || HasPublic) && + "private module requires public module"); if (!HasPrivate && !HasPublic) return {}; return ArrayRef(CurrentModuleReaders).slice(0, HasPrivate ? 2 : 1); diff --git a/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h b/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h index 27e9167ca1ad0..f8759bf2d8f25 100644 --- a/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h +++ b/clang/include/clang/ExtractAPI/Serialization/SymbolGraphSerializer.h @@ -17,7 +17,6 @@ #ifndef LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SYMBOLGRAPHSERIALIZER_H #define LLVM_CLANG_EXTRACTAPI_SERIALIZATION_SYMBOLGRAPHSERIALIZER_H -#include "clang/Basic/Module.h" #include "clang/ExtractAPI/API.h" #include "clang/ExtractAPI/APIIgnoresList.h" #include "clang/ExtractAPI/Serialization/APISetVisitor.h" diff --git a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h index 88192e439a3f0..ddd3514b3c2db 100644 --- a/clang/include/clang/Serialization/ASTWriter.h +++ b/clang/include/clang/Serialization/ASTWriter.h @@ -18,7 +18,6 @@ #include "clang/AST/Decl.h" #include "clang/AST/Type.h" #include "clang/Basic/LLVM.h" -#include "clang/Basic/Module.h" #include "clang/Basic/SourceLocation.h" #include "clang/Sema/Sema.h" #include "clang/Sema/SemaConsumer.h" @@ -277,7 +276,8 @@ class ASTWriter : public ASTDeserializationListener, std::vector TypeOffsets; /// The first ID number we can use for our own identifiers. - serialization::IdentifierID FirstIdentID = serialization::NUM_PREDEF_IDENT_IDS; + serialization::IdentifierID FirstIdentID = + serialization::NUM_PREDEF_IDENT_IDS; /// The identifier ID that will be assigned to the next new identifier. serialization::IdentifierID NextIdentID = FirstIdentID; @@ -288,7 +288,8 @@ class ASTWriter : public ASTDeserializationListener, /// The ID numbers for identifiers are consecutive (in order of /// discovery), starting at 1. An ID of zero refers to a NULL /// IdentifierInfo. - llvm::MapVector
[Lldb-commits] [clang] [clang-tools-extra] [libcxx] [lldb] [llvm] Add clang basic module directory (PR #93388)
https://github.com/davidstone updated https://github.com/llvm/llvm-project/pull/93388 >From 0933b8e0f3161c0037516f677f1de2e72811d921 Mon Sep 17 00:00:00 2001 From: David Stone Date: Sat, 25 May 2024 14:13:30 -0600 Subject: [PATCH 1/5] [clang][Modules] Move `ASTSourceDescriptor` into its own file --- .../include/clang/Basic/ASTSourceDescriptor.h | 52 +++ clang/include/clang/Basic/Module.h| 26 -- clang/lib/AST/ExternalASTSource.cpp | 2 +- clang/lib/Basic/ASTSourceDescriptor.cpp | 33 clang/lib/Basic/CMakeLists.txt| 1 + clang/lib/Basic/Module.cpp| 15 -- clang/lib/CodeGen/CGDebugInfo.h | 3 +- clang/lib/Serialization/ASTReader.cpp | 1 + .../Plugins/ExpressionParser/Clang/ASTUtils.h | 8 ++- .../Clang/ClangExternalASTSourceCallbacks.cpp | 1 + .../Clang/ClangExternalASTSourceCallbacks.h | 8 ++- 11 files changed, 105 insertions(+), 45 deletions(-) create mode 100644 clang/include/clang/Basic/ASTSourceDescriptor.h create mode 100644 clang/lib/Basic/ASTSourceDescriptor.cpp diff --git a/clang/include/clang/Basic/ASTSourceDescriptor.h b/clang/include/clang/Basic/ASTSourceDescriptor.h new file mode 100644 index 0..175e0551db765 --- /dev/null +++ b/clang/include/clang/Basic/ASTSourceDescriptor.h @@ -0,0 +1,52 @@ +//===- ASTSourceDescriptor.h -*- C++ -*-===// +// +// 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 +// +//===--===// +// +/// \file +/// Defines the clang::ASTSourceDescriptor class, which abstracts clang modules +/// and precompiled header files +// +//===--===// + +#ifndef LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H +#define LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H + +#include "clang/Basic/Module.h" +#include "llvm/ADT/StringRef.h" +#include +#include + +namespace clang { + +/// Abstracts clang modules and precompiled header files and holds +/// everything needed to generate debug info for an imported module +/// or PCH. +class ASTSourceDescriptor { + StringRef PCHModuleName; + StringRef Path; + StringRef ASTFile; + ASTFileSignature Signature; + Module *ClangModule = nullptr; + +public: + ASTSourceDescriptor() = default; + ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, + ASTFileSignature Signature) + : PCHModuleName(std::move(Name)), Path(std::move(Path)), +ASTFile(std::move(ASTFile)), Signature(Signature) {} + ASTSourceDescriptor(Module ); + + std::string getModuleName() const; + StringRef getPath() const { return Path; } + StringRef getASTFile() const { return ASTFile; } + ASTFileSignature getSignature() const { return Signature; } + Module *getModuleOrNull() const { return ClangModule; } +}; + +} // namespace clang + +#endif // LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h index 2d62d05cd9190..e86f4303d732b 100644 --- a/clang/include/clang/Basic/Module.h +++ b/clang/include/clang/Basic/Module.h @@ -868,32 +868,6 @@ class VisibleModuleSet { unsigned Generation = 0; }; -/// Abstracts clang modules and precompiled header files and holds -/// everything needed to generate debug info for an imported module -/// or PCH. -class ASTSourceDescriptor { - StringRef PCHModuleName; - StringRef Path; - StringRef ASTFile; - ASTFileSignature Signature; - Module *ClangModule = nullptr; - -public: - ASTSourceDescriptor() = default; - ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, - ASTFileSignature Signature) - : PCHModuleName(std::move(Name)), Path(std::move(Path)), -ASTFile(std::move(ASTFile)), Signature(Signature) {} - ASTSourceDescriptor(Module ); - - std::string getModuleName() const; - StringRef getPath() const { return Path; } - StringRef getASTFile() const { return ASTFile; } - ASTFileSignature getSignature() const { return Signature; } - Module *getModuleOrNull() const { return ClangModule; } -}; - - } // namespace clang #endif // LLVM_CLANG_BASIC_MODULE_H diff --git a/clang/lib/AST/ExternalASTSource.cpp b/clang/lib/AST/ExternalASTSource.cpp index e96a474968511..a5b6f80bde694 100644 --- a/clang/lib/AST/ExternalASTSource.cpp +++ b/clang/lib/AST/ExternalASTSource.cpp @@ -15,10 +15,10 @@ #include "clang/AST/ExternalASTSource.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclarationName.h" +#include "clang/Basic/ASTSourceDescriptor.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/LLVM.h" -#include "clang/Basic/Module.h" #include
[Lldb-commits] [clang] [clang-tools-extra] [libcxx] [lldb] [llvm] Add clang basic module directory (PR #93388)
https://github.com/davidstone updated https://github.com/llvm/llvm-project/pull/93388 >From 0933b8e0f3161c0037516f677f1de2e72811d921 Mon Sep 17 00:00:00 2001 From: David Stone Date: Sat, 25 May 2024 14:13:30 -0600 Subject: [PATCH 1/4] [clang][Modules] Move `ASTSourceDescriptor` into its own file --- .../include/clang/Basic/ASTSourceDescriptor.h | 52 +++ clang/include/clang/Basic/Module.h| 26 -- clang/lib/AST/ExternalASTSource.cpp | 2 +- clang/lib/Basic/ASTSourceDescriptor.cpp | 33 clang/lib/Basic/CMakeLists.txt| 1 + clang/lib/Basic/Module.cpp| 15 -- clang/lib/CodeGen/CGDebugInfo.h | 3 +- clang/lib/Serialization/ASTReader.cpp | 1 + .../Plugins/ExpressionParser/Clang/ASTUtils.h | 8 ++- .../Clang/ClangExternalASTSourceCallbacks.cpp | 1 + .../Clang/ClangExternalASTSourceCallbacks.h | 8 ++- 11 files changed, 105 insertions(+), 45 deletions(-) create mode 100644 clang/include/clang/Basic/ASTSourceDescriptor.h create mode 100644 clang/lib/Basic/ASTSourceDescriptor.cpp diff --git a/clang/include/clang/Basic/ASTSourceDescriptor.h b/clang/include/clang/Basic/ASTSourceDescriptor.h new file mode 100644 index 0..175e0551db765 --- /dev/null +++ b/clang/include/clang/Basic/ASTSourceDescriptor.h @@ -0,0 +1,52 @@ +//===- ASTSourceDescriptor.h -*- C++ -*-===// +// +// 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 +// +//===--===// +// +/// \file +/// Defines the clang::ASTSourceDescriptor class, which abstracts clang modules +/// and precompiled header files +// +//===--===// + +#ifndef LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H +#define LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H + +#include "clang/Basic/Module.h" +#include "llvm/ADT/StringRef.h" +#include +#include + +namespace clang { + +/// Abstracts clang modules and precompiled header files and holds +/// everything needed to generate debug info for an imported module +/// or PCH. +class ASTSourceDescriptor { + StringRef PCHModuleName; + StringRef Path; + StringRef ASTFile; + ASTFileSignature Signature; + Module *ClangModule = nullptr; + +public: + ASTSourceDescriptor() = default; + ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, + ASTFileSignature Signature) + : PCHModuleName(std::move(Name)), Path(std::move(Path)), +ASTFile(std::move(ASTFile)), Signature(Signature) {} + ASTSourceDescriptor(Module ); + + std::string getModuleName() const; + StringRef getPath() const { return Path; } + StringRef getASTFile() const { return ASTFile; } + ASTFileSignature getSignature() const { return Signature; } + Module *getModuleOrNull() const { return ClangModule; } +}; + +} // namespace clang + +#endif // LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h index 2d62d05cd9190..e86f4303d732b 100644 --- a/clang/include/clang/Basic/Module.h +++ b/clang/include/clang/Basic/Module.h @@ -868,32 +868,6 @@ class VisibleModuleSet { unsigned Generation = 0; }; -/// Abstracts clang modules and precompiled header files and holds -/// everything needed to generate debug info for an imported module -/// or PCH. -class ASTSourceDescriptor { - StringRef PCHModuleName; - StringRef Path; - StringRef ASTFile; - ASTFileSignature Signature; - Module *ClangModule = nullptr; - -public: - ASTSourceDescriptor() = default; - ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, - ASTFileSignature Signature) - : PCHModuleName(std::move(Name)), Path(std::move(Path)), -ASTFile(std::move(ASTFile)), Signature(Signature) {} - ASTSourceDescriptor(Module ); - - std::string getModuleName() const; - StringRef getPath() const { return Path; } - StringRef getASTFile() const { return ASTFile; } - ASTFileSignature getSignature() const { return Signature; } - Module *getModuleOrNull() const { return ClangModule; } -}; - - } // namespace clang #endif // LLVM_CLANG_BASIC_MODULE_H diff --git a/clang/lib/AST/ExternalASTSource.cpp b/clang/lib/AST/ExternalASTSource.cpp index e96a474968511..a5b6f80bde694 100644 --- a/clang/lib/AST/ExternalASTSource.cpp +++ b/clang/lib/AST/ExternalASTSource.cpp @@ -15,10 +15,10 @@ #include "clang/AST/ExternalASTSource.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclarationName.h" +#include "clang/Basic/ASTSourceDescriptor.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/LLVM.h" -#include "clang/Basic/Module.h" #include
[Lldb-commits] [clang] [clang-tools-extra] [libcxx] [lldb] [llvm] Add clang basic module directory (PR #93388)
https://github.com/davidstone updated https://github.com/llvm/llvm-project/pull/93388 >From 0933b8e0f3161c0037516f677f1de2e72811d921 Mon Sep 17 00:00:00 2001 From: David Stone Date: Sat, 25 May 2024 14:13:30 -0600 Subject: [PATCH 1/3] [clang][Modules] Move `ASTSourceDescriptor` into its own file --- .../include/clang/Basic/ASTSourceDescriptor.h | 52 +++ clang/include/clang/Basic/Module.h| 26 -- clang/lib/AST/ExternalASTSource.cpp | 2 +- clang/lib/Basic/ASTSourceDescriptor.cpp | 33 clang/lib/Basic/CMakeLists.txt| 1 + clang/lib/Basic/Module.cpp| 15 -- clang/lib/CodeGen/CGDebugInfo.h | 3 +- clang/lib/Serialization/ASTReader.cpp | 1 + .../Plugins/ExpressionParser/Clang/ASTUtils.h | 8 ++- .../Clang/ClangExternalASTSourceCallbacks.cpp | 1 + .../Clang/ClangExternalASTSourceCallbacks.h | 8 ++- 11 files changed, 105 insertions(+), 45 deletions(-) create mode 100644 clang/include/clang/Basic/ASTSourceDescriptor.h create mode 100644 clang/lib/Basic/ASTSourceDescriptor.cpp diff --git a/clang/include/clang/Basic/ASTSourceDescriptor.h b/clang/include/clang/Basic/ASTSourceDescriptor.h new file mode 100644 index 0..175e0551db765 --- /dev/null +++ b/clang/include/clang/Basic/ASTSourceDescriptor.h @@ -0,0 +1,52 @@ +//===- ASTSourceDescriptor.h -*- C++ -*-===// +// +// 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 +// +//===--===// +// +/// \file +/// Defines the clang::ASTSourceDescriptor class, which abstracts clang modules +/// and precompiled header files +// +//===--===// + +#ifndef LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H +#define LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H + +#include "clang/Basic/Module.h" +#include "llvm/ADT/StringRef.h" +#include +#include + +namespace clang { + +/// Abstracts clang modules and precompiled header files and holds +/// everything needed to generate debug info for an imported module +/// or PCH. +class ASTSourceDescriptor { + StringRef PCHModuleName; + StringRef Path; + StringRef ASTFile; + ASTFileSignature Signature; + Module *ClangModule = nullptr; + +public: + ASTSourceDescriptor() = default; + ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, + ASTFileSignature Signature) + : PCHModuleName(std::move(Name)), Path(std::move(Path)), +ASTFile(std::move(ASTFile)), Signature(Signature) {} + ASTSourceDescriptor(Module ); + + std::string getModuleName() const; + StringRef getPath() const { return Path; } + StringRef getASTFile() const { return ASTFile; } + ASTFileSignature getSignature() const { return Signature; } + Module *getModuleOrNull() const { return ClangModule; } +}; + +} // namespace clang + +#endif // LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h index 2d62d05cd9190..e86f4303d732b 100644 --- a/clang/include/clang/Basic/Module.h +++ b/clang/include/clang/Basic/Module.h @@ -868,32 +868,6 @@ class VisibleModuleSet { unsigned Generation = 0; }; -/// Abstracts clang modules and precompiled header files and holds -/// everything needed to generate debug info for an imported module -/// or PCH. -class ASTSourceDescriptor { - StringRef PCHModuleName; - StringRef Path; - StringRef ASTFile; - ASTFileSignature Signature; - Module *ClangModule = nullptr; - -public: - ASTSourceDescriptor() = default; - ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, - ASTFileSignature Signature) - : PCHModuleName(std::move(Name)), Path(std::move(Path)), -ASTFile(std::move(ASTFile)), Signature(Signature) {} - ASTSourceDescriptor(Module ); - - std::string getModuleName() const; - StringRef getPath() const { return Path; } - StringRef getASTFile() const { return ASTFile; } - ASTFileSignature getSignature() const { return Signature; } - Module *getModuleOrNull() const { return ClangModule; } -}; - - } // namespace clang #endif // LLVM_CLANG_BASIC_MODULE_H diff --git a/clang/lib/AST/ExternalASTSource.cpp b/clang/lib/AST/ExternalASTSource.cpp index e96a474968511..a5b6f80bde694 100644 --- a/clang/lib/AST/ExternalASTSource.cpp +++ b/clang/lib/AST/ExternalASTSource.cpp @@ -15,10 +15,10 @@ #include "clang/AST/ExternalASTSource.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclarationName.h" +#include "clang/Basic/ASTSourceDescriptor.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/LLVM.h" -#include "clang/Basic/Module.h" #include
[Lldb-commits] [clang] [clang-tools-extra] [libcxx] [lldb] [llvm] Add clang basic module directory (PR #93388)
https://github.com/davidstone created https://github.com/llvm/llvm-project/pull/93388 Depends on https://github.com/llvm/llvm-project/pull/67930 >From 0933b8e0f3161c0037516f677f1de2e72811d921 Mon Sep 17 00:00:00 2001 From: David Stone Date: Sat, 25 May 2024 14:13:30 -0600 Subject: [PATCH 1/2] [clang][Modules] Move `ASTSourceDescriptor` into its own file --- .../include/clang/Basic/ASTSourceDescriptor.h | 52 +++ clang/include/clang/Basic/Module.h| 26 -- clang/lib/AST/ExternalASTSource.cpp | 2 +- clang/lib/Basic/ASTSourceDescriptor.cpp | 33 clang/lib/Basic/CMakeLists.txt| 1 + clang/lib/Basic/Module.cpp| 15 -- clang/lib/CodeGen/CGDebugInfo.h | 3 +- clang/lib/Serialization/ASTReader.cpp | 1 + .../Plugins/ExpressionParser/Clang/ASTUtils.h | 8 ++- .../Clang/ClangExternalASTSourceCallbacks.cpp | 1 + .../Clang/ClangExternalASTSourceCallbacks.h | 8 ++- 11 files changed, 105 insertions(+), 45 deletions(-) create mode 100644 clang/include/clang/Basic/ASTSourceDescriptor.h create mode 100644 clang/lib/Basic/ASTSourceDescriptor.cpp diff --git a/clang/include/clang/Basic/ASTSourceDescriptor.h b/clang/include/clang/Basic/ASTSourceDescriptor.h new file mode 100644 index 0..175e0551db765 --- /dev/null +++ b/clang/include/clang/Basic/ASTSourceDescriptor.h @@ -0,0 +1,52 @@ +//===- ASTSourceDescriptor.h -*- C++ -*-===// +// +// 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 +// +//===--===// +// +/// \file +/// Defines the clang::ASTSourceDescriptor class, which abstracts clang modules +/// and precompiled header files +// +//===--===// + +#ifndef LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H +#define LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H + +#include "clang/Basic/Module.h" +#include "llvm/ADT/StringRef.h" +#include +#include + +namespace clang { + +/// Abstracts clang modules and precompiled header files and holds +/// everything needed to generate debug info for an imported module +/// or PCH. +class ASTSourceDescriptor { + StringRef PCHModuleName; + StringRef Path; + StringRef ASTFile; + ASTFileSignature Signature; + Module *ClangModule = nullptr; + +public: + ASTSourceDescriptor() = default; + ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, + ASTFileSignature Signature) + : PCHModuleName(std::move(Name)), Path(std::move(Path)), +ASTFile(std::move(ASTFile)), Signature(Signature) {} + ASTSourceDescriptor(Module ); + + std::string getModuleName() const; + StringRef getPath() const { return Path; } + StringRef getASTFile() const { return ASTFile; } + ASTFileSignature getSignature() const { return Signature; } + Module *getModuleOrNull() const { return ClangModule; } +}; + +} // namespace clang + +#endif // LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h index 2d62d05cd9190..e86f4303d732b 100644 --- a/clang/include/clang/Basic/Module.h +++ b/clang/include/clang/Basic/Module.h @@ -868,32 +868,6 @@ class VisibleModuleSet { unsigned Generation = 0; }; -/// Abstracts clang modules and precompiled header files and holds -/// everything needed to generate debug info for an imported module -/// or PCH. -class ASTSourceDescriptor { - StringRef PCHModuleName; - StringRef Path; - StringRef ASTFile; - ASTFileSignature Signature; - Module *ClangModule = nullptr; - -public: - ASTSourceDescriptor() = default; - ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, - ASTFileSignature Signature) - : PCHModuleName(std::move(Name)), Path(std::move(Path)), -ASTFile(std::move(ASTFile)), Signature(Signature) {} - ASTSourceDescriptor(Module ); - - std::string getModuleName() const; - StringRef getPath() const { return Path; } - StringRef getASTFile() const { return ASTFile; } - ASTFileSignature getSignature() const { return Signature; } - Module *getModuleOrNull() const { return ClangModule; } -}; - - } // namespace clang #endif // LLVM_CLANG_BASIC_MODULE_H diff --git a/clang/lib/AST/ExternalASTSource.cpp b/clang/lib/AST/ExternalASTSource.cpp index e96a474968511..a5b6f80bde694 100644 --- a/clang/lib/AST/ExternalASTSource.cpp +++ b/clang/lib/AST/ExternalASTSource.cpp @@ -15,10 +15,10 @@ #include "clang/AST/ExternalASTSource.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclarationName.h" +#include "clang/Basic/ASTSourceDescriptor.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/LLVM.h"
[Lldb-commits] [clang] [lldb] [clang][Modules] Move `ASTSourceDescriptor` into its own file (PR #67930)
https://github.com/davidstone updated https://github.com/llvm/llvm-project/pull/67930 >From 0933b8e0f3161c0037516f677f1de2e72811d921 Mon Sep 17 00:00:00 2001 From: David Stone Date: Sat, 25 May 2024 14:13:30 -0600 Subject: [PATCH] [clang][Modules] Move `ASTSourceDescriptor` into its own file --- .../include/clang/Basic/ASTSourceDescriptor.h | 52 +++ clang/include/clang/Basic/Module.h| 26 -- clang/lib/AST/ExternalASTSource.cpp | 2 +- clang/lib/Basic/ASTSourceDescriptor.cpp | 33 clang/lib/Basic/CMakeLists.txt| 1 + clang/lib/Basic/Module.cpp| 15 -- clang/lib/CodeGen/CGDebugInfo.h | 3 +- clang/lib/Serialization/ASTReader.cpp | 1 + .../Plugins/ExpressionParser/Clang/ASTUtils.h | 8 ++- .../Clang/ClangExternalASTSourceCallbacks.cpp | 1 + .../Clang/ClangExternalASTSourceCallbacks.h | 8 ++- 11 files changed, 105 insertions(+), 45 deletions(-) create mode 100644 clang/include/clang/Basic/ASTSourceDescriptor.h create mode 100644 clang/lib/Basic/ASTSourceDescriptor.cpp diff --git a/clang/include/clang/Basic/ASTSourceDescriptor.h b/clang/include/clang/Basic/ASTSourceDescriptor.h new file mode 100644 index 0..175e0551db765 --- /dev/null +++ b/clang/include/clang/Basic/ASTSourceDescriptor.h @@ -0,0 +1,52 @@ +//===- ASTSourceDescriptor.h -*- C++ -*-===// +// +// 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 +// +//===--===// +// +/// \file +/// Defines the clang::ASTSourceDescriptor class, which abstracts clang modules +/// and precompiled header files +// +//===--===// + +#ifndef LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H +#define LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H + +#include "clang/Basic/Module.h" +#include "llvm/ADT/StringRef.h" +#include +#include + +namespace clang { + +/// Abstracts clang modules and precompiled header files and holds +/// everything needed to generate debug info for an imported module +/// or PCH. +class ASTSourceDescriptor { + StringRef PCHModuleName; + StringRef Path; + StringRef ASTFile; + ASTFileSignature Signature; + Module *ClangModule = nullptr; + +public: + ASTSourceDescriptor() = default; + ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, + ASTFileSignature Signature) + : PCHModuleName(std::move(Name)), Path(std::move(Path)), +ASTFile(std::move(ASTFile)), Signature(Signature) {} + ASTSourceDescriptor(Module ); + + std::string getModuleName() const; + StringRef getPath() const { return Path; } + StringRef getASTFile() const { return ASTFile; } + ASTFileSignature getSignature() const { return Signature; } + Module *getModuleOrNull() const { return ClangModule; } +}; + +} // namespace clang + +#endif // LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h index 2d62d05cd9190..e86f4303d732b 100644 --- a/clang/include/clang/Basic/Module.h +++ b/clang/include/clang/Basic/Module.h @@ -868,32 +868,6 @@ class VisibleModuleSet { unsigned Generation = 0; }; -/// Abstracts clang modules and precompiled header files and holds -/// everything needed to generate debug info for an imported module -/// or PCH. -class ASTSourceDescriptor { - StringRef PCHModuleName; - StringRef Path; - StringRef ASTFile; - ASTFileSignature Signature; - Module *ClangModule = nullptr; - -public: - ASTSourceDescriptor() = default; - ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, - ASTFileSignature Signature) - : PCHModuleName(std::move(Name)), Path(std::move(Path)), -ASTFile(std::move(ASTFile)), Signature(Signature) {} - ASTSourceDescriptor(Module ); - - std::string getModuleName() const; - StringRef getPath() const { return Path; } - StringRef getASTFile() const { return ASTFile; } - ASTFileSignature getSignature() const { return Signature; } - Module *getModuleOrNull() const { return ClangModule; } -}; - - } // namespace clang #endif // LLVM_CLANG_BASIC_MODULE_H diff --git a/clang/lib/AST/ExternalASTSource.cpp b/clang/lib/AST/ExternalASTSource.cpp index e96a474968511..a5b6f80bde694 100644 --- a/clang/lib/AST/ExternalASTSource.cpp +++ b/clang/lib/AST/ExternalASTSource.cpp @@ -15,10 +15,10 @@ #include "clang/AST/ExternalASTSource.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclarationName.h" +#include "clang/Basic/ASTSourceDescriptor.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/LLVM.h" -#include "clang/Basic/Module.h" #include
[Lldb-commits] [lldb] [clang][Modules] Move `ASTSourceDescriptor` into its own file (PR #67930)
https://github.com/davidstone updated https://github.com/llvm/llvm-project/pull/67930 >From 3cb09af262cf53cecb73e2da342a7891bc9fe853 Mon Sep 17 00:00:00 2001 From: David Stone Date: Sun, 1 Oct 2023 12:02:48 -0600 Subject: [PATCH] [clang][Modules] Move `ASTSourceDescriptor` into its own file --- .../include/clang/Basic/ASTSourceDescriptor.h | 52 +++ clang/include/clang/Basic/Module.h| 26 -- clang/lib/AST/ExternalASTSource.cpp | 2 +- clang/lib/Basic/ASTSourceDescriptor.cpp | 33 clang/lib/Basic/CMakeLists.txt| 1 + clang/lib/Basic/Module.cpp| 15 -- clang/lib/CodeGen/CGDebugInfo.h | 3 +- clang/lib/Serialization/ASTReader.cpp | 1 + .../Plugins/ExpressionParser/Clang/ASTUtils.h | 8 ++- .../Clang/ClangExternalASTSourceCallbacks.cpp | 1 + .../Clang/ClangExternalASTSourceCallbacks.h | 8 ++- 11 files changed, 105 insertions(+), 45 deletions(-) create mode 100644 clang/include/clang/Basic/ASTSourceDescriptor.h create mode 100644 clang/lib/Basic/ASTSourceDescriptor.cpp diff --git a/clang/include/clang/Basic/ASTSourceDescriptor.h b/clang/include/clang/Basic/ASTSourceDescriptor.h new file mode 100644 index 000..175e0551db76562 --- /dev/null +++ b/clang/include/clang/Basic/ASTSourceDescriptor.h @@ -0,0 +1,52 @@ +//===- ASTSourceDescriptor.h -*- C++ -*-===// +// +// 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 +// +//===--===// +// +/// \file +/// Defines the clang::ASTSourceDescriptor class, which abstracts clang modules +/// and precompiled header files +// +//===--===// + +#ifndef LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H +#define LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H + +#include "clang/Basic/Module.h" +#include "llvm/ADT/StringRef.h" +#include +#include + +namespace clang { + +/// Abstracts clang modules and precompiled header files and holds +/// everything needed to generate debug info for an imported module +/// or PCH. +class ASTSourceDescriptor { + StringRef PCHModuleName; + StringRef Path; + StringRef ASTFile; + ASTFileSignature Signature; + Module *ClangModule = nullptr; + +public: + ASTSourceDescriptor() = default; + ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, + ASTFileSignature Signature) + : PCHModuleName(std::move(Name)), Path(std::move(Path)), +ASTFile(std::move(ASTFile)), Signature(Signature) {} + ASTSourceDescriptor(Module ); + + std::string getModuleName() const; + StringRef getPath() const { return Path; } + StringRef getASTFile() const { return ASTFile; } + ASTFileSignature getSignature() const { return Signature; } + Module *getModuleOrNull() const { return ClangModule; } +}; + +} // namespace clang + +#endif // LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h index 676fd372493a3aa..60381472bbd4e59 100644 --- a/clang/include/clang/Basic/Module.h +++ b/clang/include/clang/Basic/Module.h @@ -850,32 +850,6 @@ class VisibleModuleSet { unsigned Generation = 0; }; -/// Abstracts clang modules and precompiled header files and holds -/// everything needed to generate debug info for an imported module -/// or PCH. -class ASTSourceDescriptor { - StringRef PCHModuleName; - StringRef Path; - StringRef ASTFile; - ASTFileSignature Signature; - Module *ClangModule = nullptr; - -public: - ASTSourceDescriptor() = default; - ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, - ASTFileSignature Signature) - : PCHModuleName(std::move(Name)), Path(std::move(Path)), -ASTFile(std::move(ASTFile)), Signature(Signature) {} - ASTSourceDescriptor(Module ); - - std::string getModuleName() const; - StringRef getPath() const { return Path; } - StringRef getASTFile() const { return ASTFile; } - ASTFileSignature getSignature() const { return Signature; } - Module *getModuleOrNull() const { return ClangModule; } -}; - - } // namespace clang #endif // LLVM_CLANG_BASIC_MODULE_H diff --git a/clang/lib/AST/ExternalASTSource.cpp b/clang/lib/AST/ExternalASTSource.cpp index 090ef02aa4224d6..00bc6b4b919abf7 100644 --- a/clang/lib/AST/ExternalASTSource.cpp +++ b/clang/lib/AST/ExternalASTSource.cpp @@ -15,10 +15,10 @@ #include "clang/AST/ExternalASTSource.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclarationName.h" +#include "clang/Basic/ASTSourceDescriptor.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/LLVM.h" -#include "clang/Basic/Module.h" #include
[Lldb-commits] [lldb] [clang][Modules] Move `ASTSourceDescriptor` into its own file (PR #67930)
https://github.com/davidstone created https://github.com/llvm/llvm-project/pull/67930 None >From a52da2e5889f14bcc36ae4263518a49e1e85c244 Mon Sep 17 00:00:00 2001 From: David Stone Date: Sun, 1 Oct 2023 12:02:48 -0600 Subject: [PATCH] [clang][Modules] Move `ASTSourceDescriptor` into its own file --- .../include/clang/Basic/ASTSourceDescriptor.h | 52 +++ clang/include/clang/Basic/Module.h| 26 -- clang/lib/AST/ExternalASTSource.cpp | 2 +- clang/lib/Basic/ASTSourceDescriptor.cpp | 33 clang/lib/Basic/CMakeLists.txt| 1 + clang/lib/Basic/Module.cpp| 15 -- clang/lib/CodeGen/CGDebugInfo.h | 3 +- clang/lib/Serialization/ASTReader.cpp | 1 + .../Plugins/ExpressionParser/Clang/ASTUtils.h | 8 ++- .../Clang/ClangExternalASTSourceCallbacks.cpp | 1 + .../Clang/ClangExternalASTSourceCallbacks.h | 8 ++- 11 files changed, 105 insertions(+), 45 deletions(-) create mode 100644 clang/include/clang/Basic/ASTSourceDescriptor.h create mode 100644 clang/lib/Basic/ASTSourceDescriptor.cpp diff --git a/clang/include/clang/Basic/ASTSourceDescriptor.h b/clang/include/clang/Basic/ASTSourceDescriptor.h new file mode 100644 index 000..175e0551db76562 --- /dev/null +++ b/clang/include/clang/Basic/ASTSourceDescriptor.h @@ -0,0 +1,52 @@ +//===- ASTSourceDescriptor.h -*- C++ -*-===// +// +// 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 +// +//===--===// +// +/// \file +/// Defines the clang::ASTSourceDescriptor class, which abstracts clang modules +/// and precompiled header files +// +//===--===// + +#ifndef LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H +#define LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H + +#include "clang/Basic/Module.h" +#include "llvm/ADT/StringRef.h" +#include +#include + +namespace clang { + +/// Abstracts clang modules and precompiled header files and holds +/// everything needed to generate debug info for an imported module +/// or PCH. +class ASTSourceDescriptor { + StringRef PCHModuleName; + StringRef Path; + StringRef ASTFile; + ASTFileSignature Signature; + Module *ClangModule = nullptr; + +public: + ASTSourceDescriptor() = default; + ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, + ASTFileSignature Signature) + : PCHModuleName(std::move(Name)), Path(std::move(Path)), +ASTFile(std::move(ASTFile)), Signature(Signature) {} + ASTSourceDescriptor(Module ); + + std::string getModuleName() const; + StringRef getPath() const { return Path; } + StringRef getASTFile() const { return ASTFile; } + ASTFileSignature getSignature() const { return Signature; } + Module *getModuleOrNull() const { return ClangModule; } +}; + +} // namespace clang + +#endif // LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h index 676fd372493a3aa..60381472bbd4e59 100644 --- a/clang/include/clang/Basic/Module.h +++ b/clang/include/clang/Basic/Module.h @@ -850,32 +850,6 @@ class VisibleModuleSet { unsigned Generation = 0; }; -/// Abstracts clang modules and precompiled header files and holds -/// everything needed to generate debug info for an imported module -/// or PCH. -class ASTSourceDescriptor { - StringRef PCHModuleName; - StringRef Path; - StringRef ASTFile; - ASTFileSignature Signature; - Module *ClangModule = nullptr; - -public: - ASTSourceDescriptor() = default; - ASTSourceDescriptor(StringRef Name, StringRef Path, StringRef ASTFile, - ASTFileSignature Signature) - : PCHModuleName(std::move(Name)), Path(std::move(Path)), -ASTFile(std::move(ASTFile)), Signature(Signature) {} - ASTSourceDescriptor(Module ); - - std::string getModuleName() const; - StringRef getPath() const { return Path; } - StringRef getASTFile() const { return ASTFile; } - ASTFileSignature getSignature() const { return Signature; } - Module *getModuleOrNull() const { return ClangModule; } -}; - - } // namespace clang #endif // LLVM_CLANG_BASIC_MODULE_H diff --git a/clang/lib/AST/ExternalASTSource.cpp b/clang/lib/AST/ExternalASTSource.cpp index 090ef02aa4224d6..00bc6b4b919abf7 100644 --- a/clang/lib/AST/ExternalASTSource.cpp +++ b/clang/lib/AST/ExternalASTSource.cpp @@ -15,10 +15,10 @@ #include "clang/AST/ExternalASTSource.h" #include "clang/AST/ASTContext.h" #include "clang/AST/DeclarationName.h" +#include "clang/Basic/ASTSourceDescriptor.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/LLVM.h" -#include "clang/Basic/Module.h" #include