[Lldb-commits] [clang] [clang-tools-extra] [libcxx] [lldb] [llvm] Add clang basic module directory (PR #93388)

David Stone via lldb-commits lldb-commits at lists.llvm.org
Sun May 26 11:50:45 PDT 2024


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 <davidfromonline at gmail.com>
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 <memory>
 #include <vector>
 
-namespace clang::clangd {
+namespace clang {
+
+class Module;
+
+namespace clangd {
 namespace {
 struct Inclusion {
   Inclusion(const SourceManager &SM, 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<APINotesReader *> 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<serialization::UnalignedUInt64> 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<const IdentifierInfo *, serialization::IdentifierID> IdentifierIDs;
+  llvm::MapVector<const IdentifierInfo *, serialization::IdentifierID>
+      IdentifierIDs;
 
   /// The first ID number we can use for our own macros.
   serialization::MacroID FirstMacroID = serialization::NUM_PREDEF_MACRO_IDS;
@@ -351,7 +352,8 @@ class ASTWriter : public ASTDeserializationListener,
   /// Mapping from macro definitions (as they occur in the preprocessing
   /// record) to the macro IDs.
   llvm::DenseMap<const MacroDefinitionRecord *,
-                 serialization::PreprocessedEntityID> MacroDefinitions;
+                 serialization::PreprocessedEntityID>
+      MacroDefinitions;
 
   /// Cache of indices of anonymous declarations within their lexical
   /// contexts.
@@ -387,7 +389,7 @@ class ASTWriter : public ASTDeserializationListener,
     DeclUpdate(unsigned Kind, unsigned Val) : Kind(Kind), Val(Val) {}
     DeclUpdate(unsigned Kind, Module *M) : Kind(Kind), Mod(M) {}
     DeclUpdate(unsigned Kind, const Attr *Attribute)
-          : Kind(Kind), Attribute(Attribute) {}
+        : Kind(Kind), Attribute(Attribute) {}
 
     unsigned getKind() const { return Kind; }
     const Decl *getDecl() const { return Dcl; }
@@ -426,11 +428,10 @@ class ASTWriter : public ASTDeserializationListener,
   /// We keep track of external definitions and other 'interesting' declarations
   /// as we are emitting declarations to the AST file. The AST file contains a
   /// separate record for these declarations, which are provided to the AST
-  /// consumer by the AST reader. This is behavior is required to properly cope with,
-  /// e.g., tentative variable definitions that occur within
-  /// headers. The declarations themselves are stored as declaration
-  /// IDs, since they will be written out to an EAGERLY_DESERIALIZED_DECLS
-  /// record.
+  /// consumer by the AST reader. This is behavior is required to properly cope
+  /// with, e.g., tentative variable definitions that occur within headers. The
+  /// declarations themselves are stored as declaration IDs, since they will be
+  /// written out to an EAGERLY_DESERIALIZED_DECLS record.
   RecordData EagerlyDeserializedDecls;
   RecordData ModularCodegenDecls;
 
@@ -772,8 +773,8 @@ class ASTWriter : public ASTDeserializationListener,
   void AddVersionTuple(const VersionTuple &Version, RecordDataImpl &Record);
 
   /// Retrieve or create a submodule ID for this module, or return 0 if
-  /// the submodule is neither local (a submodle of the currently-written module)
-  /// nor from an imported module.
+  /// the submodule is neither local (a submodle of the currently-written
+  /// module) nor from an imported module.
   unsigned getLocalOrImportedSubmoduleID(const Module *Mod);
 
   /// Note that the identifier II occurs at the given offset
@@ -792,9 +793,7 @@ class ASTWriter : public ASTDeserializationListener,
 
   void ClearSwitchCaseIDs();
 
-  unsigned getTypeExtQualAbbrev() const {
-    return TypeExtQualAbbrev;
-  }
+  unsigned getTypeExtQualAbbrev() const { return TypeExtQualAbbrev; }
 
   unsigned getDeclParmVarAbbrev() const { return DeclParmVarAbbrev; }
   unsigned getDeclRecordAbbrev() const { return DeclRecordAbbrev; }
@@ -853,7 +852,8 @@ class ASTWriter : public ASTDeserializationListener,
 private:
   // ASTDeserializationListener implementation
   void ReaderInitialized(ASTReader *Reader) override;
-  void IdentifierRead(serialization::IdentifierID ID, IdentifierInfo *II) override;
+  void IdentifierRead(serialization::IdentifierID ID,
+                      IdentifierInfo *II) override;
   void MacroRead(serialization::MacroID ID, MacroInfo *MI) override;
   void TypeRead(serialization::TypeIdx Idx, QualType T) override;
   void SelectorRead(serialization::SelectorID ID, Selector Sel) override;
diff --git a/clang/include/clang/Serialization/ModuleManager.h b/clang/include/clang/Serialization/ModuleManager.h
index 3bd379acf7eda..09931328491b8 100644
--- a/clang/include/clang/Serialization/ModuleManager.h
+++ b/clang/include/clang/Serialization/ModuleManager.h
@@ -15,7 +15,6 @@
 #define LLVM_CLANG_SERIALIZATION_MODULEMANAGER_H
 
 #include "clang/Basic/LLVM.h"
-#include "clang/Basic/Module.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Serialization/ModuleFile.h"
 #include "llvm/ADT/DenseMap.h"
@@ -100,9 +99,7 @@ class ModuleManager {
   /// State used by the "visit" operation to avoid malloc traffic in
   /// calls to visit().
   struct VisitState {
-    explicit VisitState(unsigned N) : VisitNumber(N, 0) {
-      Stack.reserve(N);
-    }
+    explicit VisitState(unsigned N) : VisitNumber(N, 0) { Stack.reserve(N); }
 
     /// The stack used when marking the imports of a particular module
     /// as not-to-be-visited.
@@ -240,13 +237,12 @@ class ModuleManager {
   /// \return A pointer to the module that corresponds to this file name,
   /// and a value indicating whether the module was loaded.
   AddModuleResult addModule(StringRef FileName, ModuleKind Type,
-                            SourceLocation ImportLoc,
-                            ModuleFile *ImportedBy, unsigned Generation,
-                            off_t ExpectedSize, time_t ExpectedModTime,
+                            SourceLocation ImportLoc, ModuleFile *ImportedBy,
+                            unsigned Generation, off_t ExpectedSize,
+                            time_t ExpectedModTime,
                             ASTFileSignature ExpectedSignature,
                             ASTFileSignatureReader ReadSignature,
-                            ModuleFile *&Module,
-                            std::string &ErrorStr);
+                            ModuleFile *&Module, std::string &ErrorStr);
 
   /// Remove the modules starting from First (to the end).
   void removeModules(ModuleIterator First);
diff --git a/clang/lib/APINotes/APINotesManager.cpp b/clang/lib/APINotes/APINotesManager.cpp
index 789bb97d81de0..039d09fa7cf57 100644
--- a/clang/lib/APINotes/APINotesManager.cpp
+++ b/clang/lib/APINotes/APINotesManager.cpp
@@ -12,6 +12,7 @@
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/LangOptions.h"
+#include "clang/Basic/Module.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceMgrAdapter.h"
 #include "clang/Basic/Version.h"
diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp
index 6efc5bb92e28d..85779379d6d42 100644
--- a/clang/lib/AST/ASTDumper.cpp
+++ b/clang/lib/AST/ASTDumper.cpp
@@ -17,7 +17,6 @@
 #include "clang/AST/DeclLookups.h"
 #include "clang/AST/JSONNodeDumper.h"
 #include "clang/Basic/Builtins.h"
-#include "clang/Basic/Module.h"
 #include "clang/Basic/SourceManager.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -242,9 +241,7 @@ LLVM_DUMP_METHOD void Decl::dumpColor() const {
   P.Visit(this);
 }
 
-LLVM_DUMP_METHOD void DeclContext::dumpAsDecl() const {
-  dumpAsDecl(nullptr);
-}
+LLVM_DUMP_METHOD void DeclContext::dumpAsDecl() const { dumpAsDecl(nullptr); }
 
 LLVM_DUMP_METHOD void DeclContext::dumpAsDecl(const ASTContext *Ctx) const {
   // By design, DeclContext is required to be a base class of some class that
@@ -271,8 +268,7 @@ LLVM_DUMP_METHOD void DeclContext::dumpLookups() const {
   dumpLookups(llvm::errs());
 }
 
-LLVM_DUMP_METHOD void DeclContext::dumpLookups(raw_ostream &OS,
-                                               bool DumpDecls,
+LLVM_DUMP_METHOD void DeclContext::dumpLookups(raw_ostream &OS, bool DumpDecls,
                                                bool Deserialize) const {
   const DeclContext *DC = this;
   while (!DC->isTranslationUnit())
@@ -352,9 +348,7 @@ LLVM_DUMP_METHOD void APValue::dump(raw_ostream &OS,
 // ConceptReference method implementations
 //===----------------------------------------------------------------------===//
 
-LLVM_DUMP_METHOD void ConceptReference::dump() const {
-  dump(llvm::errs());
-}
+LLVM_DUMP_METHOD void ConceptReference::dump() const { dump(llvm::errs()); }
 
 LLVM_DUMP_METHOD void ConceptReference::dump(raw_ostream &OS) const {
   auto &Ctx = getNamedConcept()->getASTContext();
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index 0f68418130ead..c80c59bf12b68 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -24,7 +24,6 @@
 #include "clang/AST/Mangle.h"
 #include "clang/Basic/ABI.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Basic/Module.h"
 #include "clang/Basic/NoSanitizeList.h"
 #include "clang/Basic/ProfileList.h"
 #include "clang/Basic/TargetInfo.h"
@@ -54,7 +53,7 @@ class IndexedInstrProfReader;
 namespace vfs {
 class FileSystem;
 }
-}
+} // namespace llvm
 
 namespace clang {
 class ASTContext;
@@ -96,10 +95,7 @@ class CGHLSLRuntime;
 class CoverageMappingModuleGen;
 class TargetCodeGenInfo;
 
-enum ForDefinition_t : bool {
-  NotForDefinition = false,
-  ForDefinition = true
-};
+enum ForDefinition_t : bool { NotForDefinition = false, ForDefinition = true };
 
 struct OrderGlobalInitsOrStermFinalizers {
   unsigned int priority;
@@ -302,8 +298,8 @@ class CodeGenModule : public CodeGenTypeCache {
   ASTContext &Context;
   const LangOptions &LangOpts;
   IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS; // Only used for debug info.
-  const HeaderSearchOptions &HeaderSearchOpts; // Only used for debug info.
-  const PreprocessorOptions &PreprocessorOpts; // Only used for debug info.
+  const HeaderSearchOptions &HeaderSearchOpts;  // Only used for debug info.
+  const PreprocessorOptions &PreprocessorOpts;  // Only used for debug info.
   const CodeGenOptions &CodeGenOpts;
   unsigned NumAutoVarInit = 0;
   llvm::Module &TheModule;
@@ -340,7 +336,7 @@ class CodeGenModule : public CodeGenTypeCache {
   // A set of references that have only been seen via a weakref so far. This is
   // used to remove the weak of the reference if we ever see a direct reference
   // or a definition.
-  llvm::SmallPtrSet<llvm::GlobalValue*, 10> WeakRefReferences;
+  llvm::SmallPtrSet<llvm::GlobalValue *, 10> WeakRefReferences;
 
   /// This contains all the decls which have definitions but/ which are deferred
   /// for emission and therefore should only be output if they are actually
@@ -395,11 +391,11 @@ class CodeGenModule : public CodeGenTypeCache {
   /// want to replace a GlobalValue but can't identify it by its mangled name
   /// anymore (because the name is already taken).
   llvm::SmallVector<std::pair<llvm::GlobalValue *, llvm::Constant *>, 8>
-    GlobalValReplacements;
+      GlobalValReplacements;
 
   /// Variables for which we've emitted globals containing their constant
   /// values along with the corresponding globals, for opportunistic reuse.
-  llvm::DenseMap<const VarDecl*, llvm::GlobalVariable*> InitializerConstants;
+  llvm::DenseMap<const VarDecl *, llvm::GlobalVariable *> InitializerConstants;
 
   /// Set of global decls for which we already diagnosed mangled name conflict.
   /// Required to not issue a warning (on a mangling conflict) multiple times
@@ -407,7 +403,7 @@ class CodeGenModule : public CodeGenTypeCache {
   llvm::DenseSet<GlobalDecl> DiagnosedConflictingDefinitions;
 
   /// A queue of (optional) vtables to consider emitting.
-  std::vector<const CXXRecordDecl*> DeferredVTables;
+  std::vector<const CXXRecordDecl *> DeferredVTables;
 
   /// A queue of (optional) vtables that may be emitted opportunistically.
   std::vector<const CXXRecordDecl *> OpportunisticVTables;
@@ -431,14 +427,14 @@ class CodeGenModule : public CodeGenTypeCache {
   llvm::StringMap<GlobalDecl, llvm::BumpPtrAllocator> Manglings;
 
   /// Global annotations.
-  std::vector<llvm::Constant*> Annotations;
+  std::vector<llvm::Constant *> Annotations;
 
   // Store deferred function annotations so they can be emitted at the end with
   // most up to date ValueDecl that will have all the inherited annotations.
   llvm::DenseMap<StringRef, const ValueDecl *> DeferredAnnotations;
 
   /// Map used to get unique annotation strings.
-  llvm::StringMap<llvm::Constant*> AnnotationStrings;
+  llvm::StringMap<llvm::Constant *> AnnotationStrings;
 
   /// Used for uniquing of annotation arguments.
   llvm::DenseMap<unsigned, llvm::Constant *> AnnotationArgs;
@@ -448,9 +444,9 @@ class CodeGenModule : public CodeGenTypeCache {
   llvm::DenseMap<llvm::Constant *, llvm::GlobalVariable *> ConstantStringMap;
   llvm::DenseMap<const UnnamedGlobalConstantDecl *, llvm::GlobalVariable *>
       UnnamedGlobalConstantDeclMap;
-  llvm::DenseMap<const Decl*, llvm::Constant *> StaticLocalDeclMap;
-  llvm::DenseMap<const Decl*, llvm::GlobalVariable*> StaticLocalDeclGuardMap;
-  llvm::DenseMap<const Expr*, llvm::Constant *> MaterializedGlobalTemporaryMap;
+  llvm::DenseMap<const Decl *, llvm::Constant *> StaticLocalDeclMap;
+  llvm::DenseMap<const Decl *, llvm::GlobalVariable *> StaticLocalDeclGuardMap;
+  llvm::DenseMap<const Expr *, llvm::Constant *> MaterializedGlobalTemporaryMap;
 
   llvm::DenseMap<QualType, llvm::Constant *> AtomicSetterHelperFnMap;
   llvm::DenseMap<QualType, llvm::Constant *> AtomicGetterHelperFnMap;
@@ -460,8 +456,8 @@ class CodeGenModule : public CodeGenTypeCache {
 
   /// Map used to track internal linkage functions declared within
   /// extern "C" regions.
-  typedef llvm::MapVector<IdentifierInfo *,
-                          llvm::GlobalValue *> StaticExternCMap;
+  typedef llvm::MapVector<IdentifierInfo *, llvm::GlobalValue *>
+      StaticExternCMap;
   StaticExternCMap StaticExternCValues;
 
   /// thread_local variables defined or used in this TU.
@@ -480,7 +476,7 @@ class CodeGenModule : public CodeGenTypeCache {
   /// here so that the initializer will be performed in the correct
   /// order. Once the decl is emitted, the index is replaced with ~0U to ensure
   /// that we don't re-emit the initializer.
-  llvm::DenseMap<const Decl*, unsigned> DelayedCXXInitPosition;
+  llvm::DenseMap<const Decl *, unsigned> DelayedCXXInitPosition;
 
   typedef std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>
       GlobalInitData;
@@ -629,7 +625,8 @@ class CodeGenModule : public CodeGenTypeCache {
 
   /// Return a reference to the configured Objective-C runtime.
   CGObjCRuntime &getObjCRuntime() {
-    if (!ObjCRuntime) createObjCRuntime();
+    if (!ObjCRuntime)
+      createObjCRuntime();
     return *ObjCRuntime;
   }
 
@@ -683,8 +680,7 @@ class CodeGenModule : public CodeGenTypeCache {
   llvm::Constant *getStaticLocalDeclAddress(const VarDecl *D) {
     return StaticLocalDeclMap[D];
   }
-  void setStaticLocalDeclAddress(const VarDecl *D,
-                                 llvm::Constant *C) {
+  void setStaticLocalDeclAddress(const VarDecl *D, llvm::Constant *C) {
     StaticLocalDeclMap[D] = C;
   }
 
@@ -709,16 +705,14 @@ class CodeGenModule : public CodeGenTypeCache {
   llvm::Constant *getAtomicSetterHelperFnMap(QualType Ty) {
     return AtomicSetterHelperFnMap[Ty];
   }
-  void setAtomicSetterHelperFnMap(QualType Ty,
-                            llvm::Constant *Fn) {
+  void setAtomicSetterHelperFnMap(QualType Ty, llvm::Constant *Fn) {
     AtomicSetterHelperFnMap[Ty] = Fn;
   }
 
   llvm::Constant *getAtomicGetterHelperFnMap(QualType Ty) {
     return AtomicGetterHelperFnMap[Ty];
   }
-  void setAtomicGetterHelperFnMap(QualType Ty,
-                            llvm::Constant *Fn) {
+  void setAtomicGetterHelperFnMap(QualType Ty, llvm::Constant *Fn) {
     AtomicGetterHelperFnMap[Ty] = Fn;
   }
 
@@ -743,10 +737,12 @@ class CodeGenModule : public CodeGenTypeCache {
   const IntrusiveRefCntPtr<llvm::vfs::FileSystem> &getFileSystem() const {
     return FS;
   }
-  const HeaderSearchOptions &getHeaderSearchOpts()
-    const { return HeaderSearchOpts; }
-  const PreprocessorOptions &getPreprocessorOpts()
-    const { return PreprocessorOpts; }
+  const HeaderSearchOptions &getHeaderSearchOpts() const {
+    return HeaderSearchOpts;
+  }
+  const PreprocessorOptions &getPreprocessorOpts() const {
+    return PreprocessorOpts;
+  }
   const CodeGenOptions &getCodeGenOpts() const { return CodeGenOpts; }
   llvm::Module &getModule() const { return TheModule; }
   DiagnosticsEngine &getDiags() const { return Diags; }
@@ -873,16 +869,19 @@ class CodeGenModule : public CodeGenTypeCache {
 
   static llvm::GlobalValue::VisibilityTypes GetLLVMVisibility(Visibility V) {
     switch (V) {
-    case DefaultVisibility:   return llvm::GlobalValue::DefaultVisibility;
-    case HiddenVisibility:    return llvm::GlobalValue::HiddenVisibility;
-    case ProtectedVisibility: return llvm::GlobalValue::ProtectedVisibility;
+    case DefaultVisibility:
+      return llvm::GlobalValue::DefaultVisibility;
+    case HiddenVisibility:
+      return llvm::GlobalValue::HiddenVisibility;
+    case ProtectedVisibility:
+      return llvm::GlobalValue::ProtectedVisibility;
     }
     llvm_unreachable("unknown visibility!");
   }
 
-  llvm::Constant *GetAddrOfGlobal(GlobalDecl GD,
-                                  ForDefinition_t IsForDefinition
-                                    = NotForDefinition);
+  llvm::Constant *
+  GetAddrOfGlobal(GlobalDecl GD,
+                  ForDefinition_t IsForDefinition = NotForDefinition);
 
   /// Will return a global variable of the given type. If a variable with a
   /// different type already exists then a new  variable with the right type
@@ -922,18 +921,16 @@ class CodeGenModule : public CodeGenTypeCache {
   /// would be. If IsForDefinition is true, it is guaranteed that an actual
   /// global with type Ty will be returned, not conversion of a variable with
   /// the same mangled name but some other type.
-  llvm::Constant *GetAddrOfGlobalVar(const VarDecl *D,
-                                     llvm::Type *Ty = nullptr,
-                                     ForDefinition_t IsForDefinition
-                                       = NotForDefinition);
+  llvm::Constant *
+  GetAddrOfGlobalVar(const VarDecl *D, llvm::Type *Ty = nullptr,
+                     ForDefinition_t IsForDefinition = NotForDefinition);
 
   /// Return the address of the given function. If Ty is non-null, then this
   /// function will use the specified type if it has to create it.
-  llvm::Constant *GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty = nullptr,
-                                    bool ForVTable = false,
-                                    bool DontDefer = false,
-                                    ForDefinition_t IsForDefinition
-                                      = NotForDefinition);
+  llvm::Constant *
+  GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty = nullptr,
+                    bool ForVTable = false, bool DontDefer = false,
+                    ForDefinition_t IsForDefinition = NotForDefinition);
 
   // Return the function body address of the given function.
   llvm::Constant *GetFunctionStart(const ValueDecl *Decl);
@@ -1035,26 +1032,24 @@ class CodeGenModule : public CodeGenTypeCache {
   llvm::Constant *GetConstantArrayFromStringLiteral(const StringLiteral *E);
 
   /// Return a pointer to a constant array for the given string literal.
-  ConstantAddress
-  GetAddrOfConstantStringFromLiteral(const StringLiteral *S,
-                                     StringRef Name = ".str");
+  ConstantAddress GetAddrOfConstantStringFromLiteral(const StringLiteral *S,
+                                                     StringRef Name = ".str");
 
   /// Return a pointer to a constant array for the given ObjCEncodeExpr node.
-  ConstantAddress
-  GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *);
+  ConstantAddress GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *);
 
   /// Returns a pointer to a character array containing the literal and a
   /// terminating '\0' character. The result has pointer to array type.
   ///
   /// \param GlobalName If provided, the name to use for the global (if one is
   /// created).
-  ConstantAddress
-  GetAddrOfConstantCString(const std::string &Str,
-                           const char *GlobalName = nullptr);
+  ConstantAddress GetAddrOfConstantCString(const std::string &Str,
+                                           const char *GlobalName = nullptr);
 
   /// Returns a pointer to a constant global variable for the given file-scope
   /// compound literal expression.
-  ConstantAddress GetAddrOfConstantCompoundLiteral(const CompoundLiteralExpr*E);
+  ConstantAddress
+  GetAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *E);
 
   /// If it's been emitted already, returns the GlobalVariable corresponding to
   /// a compound literal. Otherwise, returns null.
@@ -1129,7 +1124,7 @@ class CodeGenModule : public CodeGenTypeCache {
   /// If the declaration has internal linkage but is inside an
   /// extern "C" linkage specification, prepare to emit an alias for it
   /// to the expected name.
-  template<typename SomeDecl>
+  template <typename SomeDecl>
   void MaybeHandleStaticInExternC(const SomeDecl *D, llvm::GlobalValue *GV);
 
   /// Add a global to a list to be added to the llvm.used metadata.
@@ -1176,8 +1171,7 @@ class CodeGenModule : public CodeGenTypeCache {
                         bool Local = false, bool AssumeConvergent = false);
 
   /// Create a new runtime global variable with the specified type and name.
-  llvm::Constant *CreateRuntimeVariable(llvm::Type *Ty,
-                                        StringRef Name);
+  llvm::Constant *CreateRuntimeVariable(llvm::Type *Ty, StringRef Name);
 
   ///@name Custom Blocks Runtime Interfaces
   ///@{
@@ -1300,7 +1294,6 @@ class CodeGenModule : public CodeGenTypeCache {
   /// Appends a dependent lib to the appropriate metadata value.
   void AddDependentLib(StringRef Lib);
 
-
   llvm::GlobalVariable::LinkageTypes getFunctionLinkage(GlobalDecl GD);
 
   void setFunctionLinkage(GlobalDecl GD, llvm::Function *F) {
@@ -1345,8 +1338,7 @@ class CodeGenModule : public CodeGenTypeCache {
   /// string containing the name of the translation unit. The fourth field is
   /// the line number in the file of the annotated value declaration.
   llvm::Constant *EmitAnnotateAttr(llvm::GlobalValue *GV,
-                                   const AnnotateAttr *AA,
-                                   SourceLocation L);
+                                   const AnnotateAttr *AA, SourceLocation L);
 
   /// Add global annotations that are set on D, for the global GV. Those
   /// annotations are emitted during finalization of the LLVM code.
@@ -1376,9 +1368,7 @@ class CodeGenModule : public CodeGenTypeCache {
   isFunctionBlockedFromProfileInstr(llvm::Function *Fn,
                                     SourceLocation Loc) const;
 
-  SanitizerMetadata *getSanitizerMetadata() {
-    return SanitizerMD.get();
-  }
+  SanitizerMetadata *getSanitizerMetadata() { return SanitizerMD.get(); }
 
   void addDeferredVTable(const CXXRecordDecl *RD) {
     DeferredVTables.push_back(RD);
@@ -1507,8 +1497,8 @@ class CodeGenModule : public CodeGenTypeCache {
 
   llvm::SanitizerStatReport &getSanStats();
 
-  llvm::Value *
-  createOpenCLIntToSamplerConversion(const Expr *E, CodeGenFunction &CGF);
+  llvm::Value *createOpenCLIntToSamplerConversion(const Expr *E,
+                                                  CodeGenFunction &CGF);
 
   /// OpenCL v1.2 s5.6.4.6 allows the compiler to store kernel argument
   /// information in the program executable. The argument information stored
@@ -1784,7 +1774,7 @@ class CodeGenModule : public CodeGenTypeCache {
                                                StringRef Suffix);
 };
 
-}  // end namespace CodeGen
-}  // end namespace clang
+} // end namespace CodeGen
+} // end namespace clang
 
 #endif // LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
diff --git a/clang/lib/ExtractAPI/API.cpp b/clang/lib/ExtractAPI/API.cpp
index 96bef967d8591..ab1108f663dea 100644
--- a/clang/lib/ExtractAPI/API.cpp
+++ b/clang/lib/ExtractAPI/API.cpp
@@ -14,7 +14,6 @@
 
 #include "clang/ExtractAPI/API.h"
 #include "clang/AST/RawCommentList.h"
-#include "clang/Basic/Module.h"
 #include "clang/Index/USRGeneration.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ErrorHandling.h"
diff --git a/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp b/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
index 0a48f855fba06..6124bd30b19f0 100644
--- a/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
+++ b/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
@@ -9,8 +9,6 @@
 #include "clang-tidy/ClangTidyCheck.h"
 #include "clang-tidy/ClangTidyModuleRegistry.h"
 
-#include "clang/Basic/Module.h"
-
 #include "llvm/ADT/ArrayRef.h"
 
 #include "header_exportable_declarations.hpp"

>From 6a382125350568fdf9afedfb6e7449efc5c4a8ea Mon Sep 17 00:00:00 2001
From: David Stone <davidfromonline at gmail.com>
Date: Sat, 25 May 2024 14:13:30 -0600
Subject: [PATCH 2/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 0000000000000..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 <string>
+#include <utility>
+
+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 &M);
+
+  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 &M);
-
-  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 "clang/Basic/SourceManager.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <cstdint>
diff --git a/clang/lib/Basic/ASTSourceDescriptor.cpp b/clang/lib/Basic/ASTSourceDescriptor.cpp
new file mode 100644
index 0000000000000..8072c08a51d3a
--- /dev/null
+++ b/clang/lib/Basic/ASTSourceDescriptor.cpp
@@ -0,0 +1,33 @@
+//===- ASTSourceDescriptor.cpp -------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+//
+/// Defines the clang::ASTSourceDescriptor class, which abstracts clang modules
+/// and precompiled header files
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Basic/ASTSourceDescriptor.h"
+
+namespace clang {
+
+ASTSourceDescriptor::ASTSourceDescriptor(Module &M)
+    : Signature(M.Signature), ClangModule(&M) {
+  if (M.Directory)
+    Path = M.Directory->getName();
+  if (auto File = M.getASTFile())
+    ASTFile = File->getName();
+}
+
+std::string ASTSourceDescriptor::getModuleName() const {
+  if (ClangModule)
+    return ClangModule->Name;
+  else
+    return std::string(PCHModuleName);
+}
+
+} // namespace clang
diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index 824d4a0e2eee5..f30680552e0f5 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -55,6 +55,7 @@ if(CLANG_VENDOR)
 endif()
 
 add_clang_library(clangBasic
+  ASTSourceDescriptor.cpp
   Attributes.cpp
   Builtins.cpp
   CLWarnings.cpp
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index 045ef580f9c33..90b7b0d24bb6a 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -724,18 +724,3 @@ void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc,
   };
   VisitModule({M, nullptr});
 }
-
-ASTSourceDescriptor::ASTSourceDescriptor(Module &M)
-    : Signature(M.Signature), ClangModule(&M) {
-  if (M.Directory)
-    Path = M.Directory->getName();
-  if (auto File = M.getASTFile())
-    ASTFile = File->getName();
-}
-
-std::string ASTSourceDescriptor::getModuleName() const {
-  if (ClangModule)
-    return ClangModule->Name;
-  else
-    return std::string(PCHModuleName);
-}
diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h
index d6db4d711366a..8fe738be21568 100644
--- a/clang/lib/CodeGen/CGDebugInfo.h
+++ b/clang/lib/CodeGen/CGDebugInfo.h
@@ -20,8 +20,8 @@
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeOrdering.h"
+#include "clang/Basic/ASTSourceDescriptor.h"
 #include "clang/Basic/CodeGenOptions.h"
-#include "clang/Basic/Module.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
@@ -38,6 +38,7 @@ class MDNode;
 namespace clang {
 class ClassTemplateSpecializationDecl;
 class GlobalDecl;
+class Module;
 class ModuleMap;
 class ObjCInterfaceDecl;
 class UsingDecl;
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index d7fc6697eaf74..389ac4ed76240 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -40,6 +40,7 @@
 #include "clang/AST/TypeLoc.h"
 #include "clang/AST/TypeLocVisitor.h"
 #include "clang/AST/UnresolvedSet.h"
+#include "clang/Basic/ASTSourceDescriptor.h"
 #include "clang/Basic/CommentOptions.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/DiagnosticError.h"
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h b/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
index 17f1506036c69..da2b1a15f7461 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
@@ -9,13 +9,19 @@
 #ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTUTILS_H
 #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTUTILS_H
 
-#include "clang/Basic/Module.h"
+#include "clang/Basic/ASTSourceDescriptor.h"
 #include "clang/Sema/Lookup.h"
 #include "clang/Sema/MultiplexExternalSemaSource.h"
 #include "clang/Sema/Sema.h"
 #include "clang/Sema/SemaConsumer.h"
 #include <optional>
 
+namespace clang {
+
+class Module;
+
+} // namespace clang
+
 namespace lldb_private {
 
 /// Wraps an ExternalASTSource into an ExternalSemaSource. Doesn't take
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
index 89d9ac042e57a..e746e6afe39be 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
@@ -11,6 +11,7 @@
 
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclObjC.h"
+#include "clang/Basic/Module.h"
 #include <optional>
 
 using namespace lldb_private;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
index 219ed641615eb..6bd18186a567d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
@@ -10,9 +10,15 @@
 #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXTERNALASTSOURCECALLBACKS_H
 
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/ASTSourceDescriptor.h"
 #include <optional>
 
+namespace clang {
+
+class Module;
+
+} // namespace clang
+
 namespace lldb_private {
 
 class ClangExternalASTSourceCallbacks : public clang::ExternalASTSource {

>From df43114f5a4af12d8727f62215ca3cb2b0ae59f9 Mon Sep 17 00:00:00 2001
From: David Stone <davidfromonline at gmail.com>
Date: Sat, 25 May 2024 15:17:41 -0600
Subject: [PATCH 3/3] [Clang][Modules] Add `clang/include/clang/Basic/Module`
 and `clang/lib/Basic/Module` directories.

Move `Module.h` / `Module.cpp` and `ASTSourceDescriptor.h` / `ASTSourceDescriptor.cpp` into them.
---
 .github/new-prs-labeler.yml                   |  2 +-
 clang/docs/Modules.rst                        |  2 +-
 .../Basic/{ => Module}/ASTSourceDescriptor.h  |  8 ++--
 .../include/clang/Basic/{ => Module}/Module.h | 44 +++++++------------
 .../clang/ExtractAPI/ExtractAPIVisitor.h      |  2 +-
 clang/include/clang/Lex/ModuleLoader.h        |  2 +-
 clang/include/clang/Lex/ModuleMap.h           |  2 +-
 clang/include/clang/Lex/Preprocessor.h        |  2 +-
 clang/include/clang/Sema/Sema.h               |  2 +-
 .../include/clang/Serialization/ModuleFile.h  |  2 +-
 .../Serialization/PCHContainerOperations.h    |  2 +-
 clang/lib/APINotes/APINotesManager.cpp        |  2 +-
 clang/lib/AST/ASTContext.cpp                  |  2 +-
 clang/lib/AST/Decl.cpp                        |  2 +-
 clang/lib/AST/DeclBase.cpp                    |  2 +-
 clang/lib/AST/DeclPrinter.cpp                 |  2 +-
 clang/lib/AST/ExternalASTSource.cpp           |  2 +-
 clang/lib/AST/ItaniumMangle.cpp               |  2 +-
 clang/lib/AST/ODRDiagsEmitter.cpp             |  2 +-
 clang/lib/AST/TextNodeDumper.cpp              |  2 +-
 clang/lib/Basic/CMakeLists.txt                | 14 +++---
 .../{ => Module}/ASTSourceDescriptor.cpp      |  2 +-
 clang/lib/Basic/{ => Module}/Module.cpp       | 23 +++++-----
 clang/lib/CodeGen/CGDebugInfo.h               |  2 +-
 clang/lib/CodeGen/CodeGenModule.cpp           |  2 +-
 .../TypedefUnderlyingTypeResolver.cpp         |  2 +-
 clang/lib/Frontend/ASTUnit.cpp                |  2 +-
 clang/lib/Frontend/FrontendActions.cpp        |  2 +-
 clang/lib/Lex/HeaderSearch.cpp                |  4 +-
 clang/lib/Lex/ModuleMap.cpp                   |  2 +-
 clang/lib/Lex/PPDirectives.cpp                |  2 +-
 clang/lib/Lex/Pragma.cpp                      |  2 +-
 clang/lib/Lex/Preprocessor.cpp                |  2 +-
 clang/lib/Serialization/ASTReader.cpp         |  4 +-
 clang/lib/Serialization/ASTReaderDecl.cpp     |  2 +-
 clang/lib/Serialization/ASTWriter.cpp         |  2 +-
 .../Plugins/ExpressionParser/Clang/ASTUtils.h |  2 +-
 .../Clang/ClangExternalASTSourceCallbacks.cpp |  1 -
 .../Clang/ClangExternalASTSourceCallbacks.h   |  2 +-
 39 files changed, 75 insertions(+), 87 deletions(-)
 rename clang/include/clang/Basic/{ => Module}/ASTSourceDescriptor.h (88%)
 rename clang/include/clang/Basic/{ => Module}/Module.h (96%)
 rename clang/lib/Basic/{ => Module}/ASTSourceDescriptor.cpp (94%)
 rename clang/lib/Basic/{ => Module}/Module.cpp (97%)

diff --git a/.github/new-prs-labeler.yml b/.github/new-prs-labeler.yml
index a57ba28faf160..41325b2ff2e24 100644
--- a/.github/new-prs-labeler.yml
+++ b/.github/new-prs-labeler.yml
@@ -345,7 +345,7 @@ clang:modules:
   - clang/include/clang/AST/PropertiesBase.td
   - clang/include/clang/AST/ODRHash.h
   - clang/include/clang/AST/TypeProperties.td
-  - clang/include/clang/Basic/Module.h
+  - clang/include/clang/Basic/Module/**
   - clang/include/clang/Frontend/PrecompiledPreamble.h
   - clang/include/clang/Lex/ModuleLoader.h
   - clang/include/clang/Lex/ModuleMap.h
diff --git a/clang/docs/Modules.rst b/clang/docs/Modules.rst
index 06294e3c58a4f..79c87250ad0d5 100644
--- a/clang/docs/Modules.rst
+++ b/clang/docs/Modules.rst
@@ -1126,7 +1126,7 @@ The Clang source code provides additional information about modules:
 ``clang/test/Modules/``
   Tests specifically related to modules functionality.
 
-``clang/include/clang/Basic/Module.h``
+``clang/include/clang/Basic/Module/Module.h``
   The ``Module`` class in this header describes a module, and is used throughout the compiler to implement modules.
 
 ``clang/include/clang/Lex/ModuleMap.h``
diff --git a/clang/include/clang/Basic/ASTSourceDescriptor.h b/clang/include/clang/Basic/Module/ASTSourceDescriptor.h
similarity index 88%
rename from clang/include/clang/Basic/ASTSourceDescriptor.h
rename to clang/include/clang/Basic/Module/ASTSourceDescriptor.h
index 175e0551db765..315fa3a4e8bcf 100644
--- a/clang/include/clang/Basic/ASTSourceDescriptor.h
+++ b/clang/include/clang/Basic/Module/ASTSourceDescriptor.h
@@ -12,10 +12,10 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H
-#define LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H
+#ifndef LLVM_CLANG_BASIC_MODULE_ASTSOURCEDESCRIPTOR_H
+#define LLVM_CLANG_BASIC_MODULE_ASTSOURCEDESCRIPTOR_H
 
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "llvm/ADT/StringRef.h"
 #include <string>
 #include <utility>
@@ -49,4 +49,4 @@ class ASTSourceDescriptor {
 
 } // namespace clang
 
-#endif // LLVM_CLANG_BASIC_ASTSOURCEDESCRIPTOR_H
+#endif // LLVM_CLANG_BASIC_MODULE_ASTSOURCEDESCRIPTOR_H
diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module/Module.h
similarity index 96%
rename from clang/include/clang/Basic/Module.h
rename to clang/include/clang/Basic/Module/Module.h
index e86f4303d732b..4aba0dd68391a 100644
--- a/clang/include/clang/Basic/Module.h
+++ b/clang/include/clang/Basic/Module/Module.h
@@ -12,8 +12,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_CLANG_BASIC_MODULE_H
-#define LLVM_CLANG_BASIC_MODULE_H
+#ifndef LLVM_CLANG_BASIC_MODULE_MODULE_H
+#define LLVM_CLANG_BASIC_MODULE_MODULE_H
 
 #include "clang/Basic/DirectoryEntry.h"
 #include "clang/Basic/FileEntry.h"
@@ -230,7 +230,7 @@ class alignas(8) Module {
   std::vector<std::string> TopHeaderNames;
 
   /// Cache of modules visible to lookup in this module.
-  mutable llvm::DenseSet<const Module*> VisibleModulesCache;
+  mutable llvm::DenseSet<const Module *> VisibleModulesCache;
 
   /// The ID used when referencing this module within a VisibleModuleSet.
   unsigned VisibilityID;
@@ -545,10 +545,8 @@ class alignas(8) Module {
   ///
   /// \param ShadowingModule If this module is unavailable because it is
   /// shadowed, this parameter will be set to the shadowing module.
-  bool isAvailable(const LangOptions &LangOpts,
-                   const TargetInfo &Target,
-                   Requirement &Req,
-                   UnresolvedHeaderDirective &MissingHeader,
+  bool isAvailable(const LangOptions &LangOpts, const TargetInfo &Target,
+                   Requirement &Req, UnresolvedHeaderDirective &MissingHeader,
                    Module *&ShadowingModule) const;
 
   /// Determine whether this module is a submodule.
@@ -665,7 +663,7 @@ class alignas(8) Module {
   /// be this module.
   Module *getTopLevelModule() {
     return const_cast<Module *>(
-             const_cast<const Module *>(this)->getTopLevelModule());
+        const_cast<const Module *>(this)->getTopLevelModule());
   }
 
   /// Retrieve the top-level module for this (sub)module, which may
@@ -673,9 +671,7 @@ class alignas(8) Module {
   const Module *getTopLevelModule() const;
 
   /// Retrieve the name of the top-level module.
-  StringRef getTopLevelModuleName() const {
-    return getTopLevelModule()->Name;
-  }
+  StringRef getTopLevelModuleName() const { return getTopLevelModule()->Name; }
 
   /// The serialized AST file for this module, if one was created.
   OptionalFileEntryRef getASTFile() const {
@@ -739,8 +735,7 @@ class alignas(8) Module {
   /// \param Target The target options that will be used to evaluate the
   /// availability of this feature.
   void addRequirement(StringRef Feature, bool RequiredState,
-                      const LangOptions &LangOpts,
-                      const TargetInfo &Target);
+                      const LangOptions &LangOpts, const TargetInfo &Target);
 
   /// Mark this module and all of its submodules as unavailable.
   void markUnavailable(bool Unimportable);
@@ -793,9 +788,7 @@ class alignas(8) Module {
   /// directly exported), not the complete set of exported modules.
   void getExportedModules(SmallVectorImpl<Module *> &Exported) const;
 
-  static StringRef getModuleInputBufferName() {
-    return "<module-includes>";
-  }
+  static StringRef getModuleInputBufferName() { return "<module-includes>"; }
 
   /// Print the module map for this module to the given stream.
   void print(raw_ostream &OS, unsigned Indent = 0, bool Dump = false) const;
@@ -832,9 +825,7 @@ class VisibleModuleSet {
   unsigned getGeneration() const { return Generation; }
 
   /// Determine whether a module is visible.
-  bool isVisible(const Module *M) const {
-    return getImportLoc(M).isValid();
-  }
+  bool isVisible(const Module *M) const { return getImportLoc(M).isValid(); }
 
   /// Get the location at which the import of a module was triggered.
   SourceLocation getImportLoc(const Module *M) const {
@@ -850,15 +841,14 @@ class VisibleModuleSet {
   /// A callback to call when a module conflict is found. \p Path
   /// consists of a sequence of modules from the conflicting module to the one
   /// made visible, where each was exported by the next.
-  using ConflictCallback =
-      llvm::function_ref<void(ArrayRef<Module *> Path, Module *Conflict,
-                         StringRef Message)>;
+  using ConflictCallback = llvm::function_ref<void(
+      ArrayRef<Module *> Path, Module *Conflict, StringRef Message)>;
 
   /// Make a specific module visible.
-  void setVisible(Module *M, SourceLocation Loc,
-                  VisibleCallback Vis = [](Module *) {},
-                  ConflictCallback Cb = [](ArrayRef<Module *>, Module *,
-                                           StringRef) {});
+  void setVisible(
+      Module *M, SourceLocation Loc, VisibleCallback Vis = [](Module *) {},
+      ConflictCallback Cb = [](ArrayRef<Module *>, Module *, StringRef) {});
+
 private:
   /// Import locations for each visible module. Indexed by the module's
   /// VisibilityID.
@@ -870,4 +860,4 @@ class VisibleModuleSet {
 
 } // namespace clang
 
-#endif // LLVM_CLANG_BASIC_MODULE_H
+#endif // LLVM_CLANG_BASIC_MODULE_MODULE_H
diff --git a/clang/include/clang/ExtractAPI/ExtractAPIVisitor.h b/clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
index 8ccebe457ed53..e1fe750328bec 100644
--- a/clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
+++ b/clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
@@ -21,7 +21,7 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/ParentMapContext.h"
 #include "clang/AST/RecursiveASTVisitor.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/ExtractAPI/API.h"
diff --git a/clang/include/clang/Lex/ModuleLoader.h b/clang/include/clang/Lex/ModuleLoader.h
index f880a9091a2ed..43318571ef822 100644
--- a/clang/include/clang/Lex/ModuleLoader.h
+++ b/clang/include/clang/Lex/ModuleLoader.h
@@ -15,7 +15,7 @@
 #define LLVM_CLANG_LEX_MODULELOADER_H
 
 #include "clang/Basic/LLVM.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/PointerIntPair.h"
diff --git a/clang/include/clang/Lex/ModuleMap.h b/clang/include/clang/Lex/ModuleMap.h
index 2e28ff6823cb2..1a1f246b76155 100644
--- a/clang/include/clang/Lex/ModuleMap.h
+++ b/clang/include/clang/Lex/ModuleMap.h
@@ -16,7 +16,7 @@
 
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index c0850a8fa9f7f..986ea0ba8c3c4 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -19,7 +19,7 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TokenKinds.h"
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 5247379181808..dd01197c8fafa 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -40,7 +40,7 @@
 #include "clang/Basic/DarwinSDKInfo.h"
 #include "clang/Basic/ExpressionTraits.h"
 #include "clang/Basic/IdentifierTable.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/OpenCLOptions.h"
 #include "clang/Basic/PragmaKinds.h"
 #include "clang/Basic/Specifiers.h"
diff --git a/clang/include/clang/Serialization/ModuleFile.h b/clang/include/clang/Serialization/ModuleFile.h
index 7d8cbe3d40f56..e395397158a3b 100644
--- a/clang/include/clang/Serialization/ModuleFile.h
+++ b/clang/include/clang/Serialization/ModuleFile.h
@@ -15,7 +15,7 @@
 #define LLVM_CLANG_SERIALIZATION_MODULEFILE_H
 
 #include "clang/Basic/FileManager.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Serialization/ASTBitCodes.h"
 #include "clang/Serialization/ContinuousRangeMap.h"
diff --git a/clang/include/clang/Serialization/PCHContainerOperations.h b/clang/include/clang/Serialization/PCHContainerOperations.h
index c9a7e334ce6eb..26d45fea66e2e 100644
--- a/clang/include/clang/Serialization/PCHContainerOperations.h
+++ b/clang/include/clang/Serialization/PCHContainerOperations.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_CLANG_SERIALIZATION_PCHCONTAINEROPERATIONS_H
 #define LLVM_CLANG_SERIALIZATION_PCHCONTAINEROPERATIONS_H
 
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/MemoryBufferRef.h"
diff --git a/clang/lib/APINotes/APINotesManager.cpp b/clang/lib/APINotes/APINotesManager.cpp
index 039d09fa7cf57..4ea80e3d4c9d3 100644
--- a/clang/lib/APINotes/APINotesManager.cpp
+++ b/clang/lib/APINotes/APINotesManager.cpp
@@ -12,7 +12,7 @@
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/SourceMgrAdapter.h"
 #include "clang/Basic/Version.h"
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index a2398fef623ea..98675bd206946 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -56,7 +56,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/Linkage.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/NoSanitizeList.h"
 #include "clang/Basic/ObjCRuntime.h"
 #include "clang/Basic/ProfileList.h"
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 41fbfe281ef65..fe01d2606e4dc 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -42,7 +42,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/Linkage.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/NoSanitizeList.h"
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/Sanitizers.h"
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 65d5eeb6354eb..a70f59f414212 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -29,7 +29,7 @@
 #include "clang/AST/Type.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LLVM.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/ObjCRuntime.h"
 #include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 0cf4e64f83b8d..c07936ea2d3e9 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -20,7 +20,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/PrettyPrinter.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceManager.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace clang;
diff --git a/clang/lib/AST/ExternalASTSource.cpp b/clang/lib/AST/ExternalASTSource.cpp
index a5b6f80bde694..61c650d463791 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/ASTSourceDescriptor.h"
 #include "clang/Basic/SourceManager.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <cstdint>
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index ed9e6eeb36c75..4d010b70cd8b4 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -29,7 +29,7 @@
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/ABI.h"
 #include "clang/Basic/DiagnosticAST.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/Thunk.h"
diff --git a/clang/lib/AST/ODRDiagsEmitter.cpp b/clang/lib/AST/ODRDiagsEmitter.cpp
index 37f0f68c92355..d262dd87cfff2 100644
--- a/clang/lib/AST/ODRDiagsEmitter.cpp
+++ b/clang/lib/AST/ODRDiagsEmitter.cpp
@@ -11,7 +11,7 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/ODRHash.h"
 #include "clang/Basic/DiagnosticAST.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 
 using namespace clang;
 
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index 4a1e94ffe283b..5299ebbfbfb42 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -19,7 +19,7 @@
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeLocVisitor.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Basic/TypeTraits.h"
diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt
index f30680552e0f5..fae3ef13b8796 100644
--- a/clang/lib/Basic/CMakeLists.txt
+++ b/clang/lib/Basic/CMakeLists.txt
@@ -55,12 +55,11 @@ if(CLANG_VENDOR)
 endif()
 
 add_clang_library(clangBasic
-  ASTSourceDescriptor.cpp
-  Attributes.cpp
-  Builtins.cpp
-  CLWarnings.cpp
-  CharInfo.cpp
-  CodeGenOptions.cpp
+Attributes.cpp
+Builtins.cpp
+CLWarnings.cpp
+CharInfo.cpp
+CodeGenOptions.cpp
   Cuda.cpp
   DarwinSDKInfo.cpp
   Diagnostic.cpp
@@ -74,7 +73,8 @@ add_clang_library(clangBasic
   LangOptions.cpp
   LangStandards.cpp
   MakeSupport.cpp
-  Module.cpp
+  Module/ASTSourceDescriptor.cpp
+  Module/Module.cpp
   ObjCRuntime.cpp
   OpenCLOptions.cpp
   OpenMPKinds.cpp
diff --git a/clang/lib/Basic/ASTSourceDescriptor.cpp b/clang/lib/Basic/Module/ASTSourceDescriptor.cpp
similarity index 94%
rename from clang/lib/Basic/ASTSourceDescriptor.cpp
rename to clang/lib/Basic/Module/ASTSourceDescriptor.cpp
index 8072c08a51d3a..b27cd45b4cb74 100644
--- a/clang/lib/Basic/ASTSourceDescriptor.cpp
+++ b/clang/lib/Basic/Module/ASTSourceDescriptor.cpp
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/Basic/ASTSourceDescriptor.h"
+#include "clang/Basic/Module/ASTSourceDescriptor.h"
 
 namespace clang {
 
diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module/Module.cpp
similarity index 97%
rename from clang/lib/Basic/Module.cpp
rename to clang/lib/Basic/Module/Module.cpp
index 90b7b0d24bb6a..4bc8e63e3ecfe 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module/Module.cpp
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/CharInfo.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/LangOptions.h"
@@ -78,7 +78,7 @@ static bool isPlatformEnvironment(const TargetInfo &Target, StringRef Feature) {
     if (Pos == StringRef::npos)
       return false;
     SmallString<128> NewLHS = LHS.slice(0, Pos);
-    NewLHS += LHS.slice(Pos+1, LHS.size());
+    NewLHS += LHS.slice(Pos + 1, LHS.size());
     return NewLHS == RHS;
   };
 
@@ -218,7 +218,7 @@ static StringRef getModuleNameFromComponent(
 
 static StringRef getModuleNameFromComponent(StringRef R) { return R; }
 
-template<typename InputIter>
+template <typename InputIter>
 static void printModuleId(raw_ostream &OS, InputIter Begin, InputIter End,
                           bool AllowStringLiterals = true) {
   for (InputIter It = Begin; It != End; ++It) {
@@ -236,7 +236,7 @@ static void printModuleId(raw_ostream &OS, InputIter Begin, InputIter End,
   }
 }
 
-template<typename Container>
+template <typename Container>
 static void printModuleId(raw_ostream &OS, const Container &C) {
   return printModuleId(OS, C.begin(), C.end());
 }
@@ -325,7 +325,7 @@ void Module::addRequirement(StringRef Feature, bool RequiredState,
   if (hasFeature(Feature, LangOpts, Target) == RequiredState)
     return;
 
-  markUnavailable(/*Unimportable*/true);
+  markUnavailable(/*Unimportable*/ true);
 }
 
 void Module::markUnavailable(bool Unimportable) {
@@ -368,7 +368,8 @@ Module *Module::findOrInferSubmodule(StringRef Name) {
     return SubModules[Pos->getValue()];
   if (!InferSubmodules)
     return nullptr;
-  Module *Result = new Module(Name, SourceLocation(), this, false, InferExplicitSubmodules, 0);
+  Module *Result = new Module(Name, SourceLocation(), this, false,
+                              InferExplicitSubmodules, 0);
   Result->InferExplicitSubmodules = InferExplicitSubmodules;
   Result->InferSubmodules = InferSubmodules;
   Result->InferExportWildcard = InferExportWildcard;
@@ -551,8 +552,8 @@ void Module::print(raw_ostream &OS, unsigned Indent, bool Dump) const {
       OS.indent(Indent + 2);
       OS << K.Prefix << "header \"";
       OS.write_escaped(H.NameAsWritten);
-      OS << "\" { size " << H.Entry.getSize()
-         << " mtime " << H.Entry.getModificationTime() << " }\n";
+      OS << "\" { size " << H.Entry.getSize() << " mtime "
+         << H.Entry.getModificationTime() << " }\n";
     }
   }
   for (auto *Unresolved : {&UnresolvedHeaders, &MissingHeaders}) {
@@ -674,9 +675,7 @@ void Module::print(raw_ostream &OS, unsigned Indent, bool Dump) const {
   OS << "}\n";
 }
 
-LLVM_DUMP_METHOD void Module::dump() const {
-  print(llvm::errs(), 0, true);
-}
+LLVM_DUMP_METHOD void Module::dump() const { print(llvm::errs(), 0, true); }
 
 void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc,
                                   VisibleCallback Vis, ConflictCallback Cb) {
@@ -715,7 +714,7 @@ void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc,
 
     for (auto &C : V.M->Conflicts) {
       if (isVisible(C.Other)) {
-        llvm::SmallVector<Module*, 8> Path;
+        llvm::SmallVector<Module *, 8> Path;
         for (Visiting *I = &V; I; I = I->ExportedBy)
           Path.push_back(I->M);
         Cb(Path, C.Other, C.Message);
diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h
index 8fe738be21568..7a767508b0a8c 100644
--- a/clang/lib/CodeGen/CGDebugInfo.h
+++ b/clang/lib/CodeGen/CGDebugInfo.h
@@ -20,8 +20,8 @@
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/Type.h"
 #include "clang/AST/TypeOrdering.h"
-#include "clang/Basic/ASTSourceDescriptor.h"
 #include "clang/Basic/CodeGenOptions.h"
+#include "clang/Basic/Module/ASTSourceDescriptor.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index e4774a587707a..993699a3b2a93 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -42,7 +42,7 @@
 #include "clang/Basic/CodeGenOptions.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/FileManager.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Basic/Version.h"
diff --git a/clang/lib/ExtractAPI/TypedefUnderlyingTypeResolver.cpp b/clang/lib/ExtractAPI/TypedefUnderlyingTypeResolver.cpp
index 41e4e0cf1795f..cf105726ae6ff 100644
--- a/clang/lib/ExtractAPI/TypedefUnderlyingTypeResolver.cpp
+++ b/clang/lib/ExtractAPI/TypedefUnderlyingTypeResolver.cpp
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/ExtractAPI/TypedefUnderlyingTypeResolver.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Index/USRGeneration.h"
 
 using namespace clang;
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 8d24d5d422520..959ef895a0893 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -31,7 +31,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/LangStandard.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp
index 454653a31534c..e41dd4c796523 100644
--- a/clang/lib/Frontend/FrontendActions.cpp
+++ b/clang/lib/Frontend/FrontendActions.cpp
@@ -11,7 +11,7 @@
 #include "clang/AST/Decl.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/LangStandard.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/TargetInfo.h"
 #include "clang/Frontend/ASTConsumers.h"
 #include "clang/Frontend/CompilerInstance.h"
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index 574723b33866a..ad49de7cde754 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -14,7 +14,7 @@
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/IdentifierTable.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Lex/DirectoryLookup.h"
 #include "clang/Lex/ExternalPreprocessorSource.h"
@@ -25,11 +25,11 @@
 #include "clang/Lex/Preprocessor.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/Hashing.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Capacity.h"
 #include "llvm/Support/Errc.h"
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index eed7eca2e7356..37c259d9da5ae 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -17,7 +17,7 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 8e7386449dced..95a14bee51874 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -16,7 +16,7 @@
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TokenKinds.h"
diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp
index 10f0ab7180e62..6a0dffdc8788e 100644
--- a/clang/lib/Lex/Pragma.cpp
+++ b/clang/lib/Lex/Pragma.cpp
@@ -18,7 +18,7 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TokenKinds.h"
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 0b70192743a39..be9646cbb8d8e 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -31,7 +31,7 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/TargetInfo.h"
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 389ac4ed76240..95a62095d448a 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -40,7 +40,6 @@
 #include "clang/AST/TypeLoc.h"
 #include "clang/AST/TypeLocVisitor.h"
 #include "clang/AST/UnresolvedSet.h"
-#include "clang/Basic/ASTSourceDescriptor.h"
 #include "clang/Basic/CommentOptions.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/DiagnosticError.h"
@@ -52,7 +51,8 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/ASTSourceDescriptor.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/ObjCRuntime.h"
 #include "clang/Basic/OpenACCKinds.h"
 #include "clang/Basic/OpenMPKinds.h"
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index 61cc99d4df687..8cb291d00eee0 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -45,7 +45,7 @@
 #include "clang/Basic/Lambda.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/Linkage.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/PragmaKinds.h"
 #include "clang/Basic/SourceLocation.h"
 #include "clang/Basic/Specifiers.h"
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 00b0e48083217..6a3173b74c0c3 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -43,7 +43,7 @@
 #include "clang/Basic/LLVM.h"
 #include "clang/Basic/Lambda.h"
 #include "clang/Basic/LangOptions.h"
-#include "clang/Basic/Module.h"
+#include "clang/Basic/Module/Module.h"
 #include "clang/Basic/ObjCRuntime.h"
 #include "clang/Basic/OpenACCKinds.h"
 #include "clang/Basic/OpenCLOptions.h"
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h b/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
index da2b1a15f7461..74cde0c89cb08 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
@@ -9,7 +9,7 @@
 #ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTUTILS_H
 #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTUTILS_H
 
-#include "clang/Basic/ASTSourceDescriptor.h"
+#include "clang/Basic/Module/ASTSourceDescriptor.h"
 #include "clang/Sema/Lookup.h"
 #include "clang/Sema/MultiplexExternalSemaSource.h"
 #include "clang/Sema/Sema.h"
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
index e746e6afe39be..89d9ac042e57a 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp
@@ -11,7 +11,6 @@
 
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclObjC.h"
-#include "clang/Basic/Module.h"
 #include <optional>
 
 using namespace lldb_private;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
index 6bd18186a567d..c874e5be23547 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h
@@ -10,7 +10,7 @@
 #define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGEXTERNALASTSOURCECALLBACKS_H
 
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
-#include "clang/Basic/ASTSourceDescriptor.h"
+#include "clang/Basic/Module/ASTSourceDescriptor.h"
 #include <optional>
 
 namespace clang {



More information about the lldb-commits mailing list