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

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


https://github.com/hubert-reinterpretcast created https://github.com/llvm/llvm-project/pull/112846

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


>From 0061e5cbc06473586d6058af6234c3afff57b515 Mon Sep 17 00:00:00 2001
From: Hubert Tong <hstong at ca.ibm.com>
Date: Wed, 9 Oct 2024 18:34:28 -0400
Subject: [PATCH] [Legacy ThinLTO] NFC: Move helper class to an "Impl"
 namespace

`::llvm::TargetMachineBuilder` is only a helper class for
`ThinLTOCodeGenerator` and not a real facility. Move it into an "Impl"
namespace.
---
 llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h | 11 +++++++++--
 llvm/lib/LTO/ThinLTOCodeGenerator.cpp               |  1 +
 2 files changed, 10 insertions(+), 2 deletions(-)

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"
 



More information about the llvm-commits mailing list