[llvm] 76316ec - [Legacy ThinLTO] NFC: Use explicit `static`; shrink anonymous namespace
Hubert Tong via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 24 13:19:57 PDT 2024
Author: Hubert Tong
Date: 2024-10-24T16:19:50-04:00
New Revision: 76316ec91410bfe4775f828e3ebae5958a9d2a1d
URL: https://github.com/llvm/llvm-project/commit/76316ec91410bfe4775f828e3ebae5958a9d2a1d
DIFF: https://github.com/llvm/llvm-project/commit/76316ec91410bfe4775f828e3ebae5958a9d2a1d.diff
LOG: [Legacy ThinLTO] NFC: Use explicit `static`; shrink anonymous namespace
Improve compliance with
https://llvm.org/docs/CodingStandards.html#anonymous-namespaces:
> [Only] use [anonymous namespaces] for class declarations.
Added:
Modified:
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
Removed:
################################################################################
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 311510ed9fabc2..4522f4adcebe68 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -85,8 +85,6 @@ extern cl::opt<std::optional<uint64_t>, false, remarks::HotnessThresholdParser>
extern cl::opt<std::string> RemarksFormat;
}
-namespace {
-
// Default to using all available threads in the system, but using only one
// thred per core, as indicated by the usage of
// heavyweight_hardware_concurrency() below.
@@ -326,8 +324,8 @@ computeGUIDPreservedSymbols(const lto::InputFile &File,
return GUIDPreservedSymbols;
}
-std::unique_ptr<MemoryBuffer> codegenModule(Module &TheModule,
- TargetMachine &TM) {
+static std::unique_ptr<MemoryBuffer> codegenModule(Module &TheModule,
+ TargetMachine &TM) {
SmallVector<char, 128> OutputBuffer;
// CodeGen
@@ -347,6 +345,7 @@ std::unique_ptr<MemoryBuffer> codegenModule(Module &TheModule,
std::move(OutputBuffer), /*RequiresNullTerminator=*/false);
}
+namespace {
/// Manage caching for a single Module.
class ModuleCacheEntry {
SmallString<128> EntryPath;
@@ -424,6 +423,7 @@ class ModuleCacheEntry {
toString(std::move(Err)).c_str()));
}
};
+} // end anonymous namespace
static std::unique_ptr<MemoryBuffer>
ProcessThinLTOModule(Module &TheModule, ModuleSummaryIndex &Index,
@@ -541,8 +541,6 @@ static void initTMBuilder(TargetMachineBuilder &TMBuilder,
TMBuilder.TheTriple = std::move(TheTriple);
}
-} // end anonymous namespace
-
void ThinLTOCodeGenerator::addModule(StringRef Identifier, StringRef Data) {
MemoryBufferRef Buffer(Data, Identifier);
More information about the llvm-commits
mailing list