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 &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/Source