[llvm] [Legacy ThinLTO] NFC: Move helper class to an "Impl" namespace (PR #112846)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 23:43:36 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lto

Author: Hubert Tong (hubert-reinterpretcast)

<details>
<summary>Changes</summary>

`::llvm::TargetMachineBuilder` is only a helper class for
`ThinLTOCodeGenerator` and not a real facility. Move it into an "Impl"
namespace.


---
Full diff: https://github.com/llvm/llvm-project/pull/112846.diff


2 Files Affected:

- (modified) llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h (+9-2) 
- (modified) llvm/lib/LTO/ThinLTOCodeGenerator.cpp (+1) 


``````````diff
diff --git a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
index 7eb30d56e10c10..676d4e179bed4b 100644
--- a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
+++ b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
@@ -31,8 +31,15 @@ namespace llvm {
 class StringRef;
 class TargetMachine;
 
+/// ThinLTOCodeGeneratorImpl - Namespace used for ThinLTOCodeGenerator
+/// implementation details. It should be considered private to the
+/// implementation.
+namespace ThinLTOCodeGeneratorImpl {
+struct TargetMachineBuilder;
+}
+
 /// Helper to gather options relevant to the target machine creation
-struct TargetMachineBuilder {
+struct ThinLTOCodeGeneratorImpl::TargetMachineBuilder {
   Triple TheTriple;
   std::string MCpu;
   std::string MAttr;
@@ -301,7 +308,7 @@ class ThinLTOCodeGenerator {
 
 private:
   /// Helper factory to build a TargetMachine
-  TargetMachineBuilder TMBuilder;
+  ThinLTOCodeGeneratorImpl::TargetMachineBuilder TMBuilder;
 
   /// Vector holding the in-memory buffer containing the produced binaries, when
   /// SavedObjectsDirectoryPath isn't set.
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 8074f8690cc1ce..311510ed9fabc2 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -70,6 +70,7 @@
 #endif
 
 using namespace llvm;
+using namespace ThinLTOCodeGeneratorImpl;
 
 #define DEBUG_TYPE "thinlto"
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/112846


More information about the llvm-commits mailing list