[lld] [lld][MachO] Implement -emit-tbd-only= (PR #194899)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 29 09:26:05 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- lld/MachO/Config.h lld/MachO/Driver.cpp lld/MachO/InputFiles.cpp lld/MachO/LTO.cpp lld/MachO/LTO.h lld/MachO/SymbolTable.cpp lld/MachO/SymbolTable.h lld/MachO/Symbols.cpp lld/MachO/Symbols.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index abb827a6f..a6001f1b1 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -1640,7 +1640,8 @@ static void handleExplicitExports() {
static constexpr int kMaxWarnings = 3;
if (config->hasExplicitExports) {
std::atomic<uint64_t> warningsCount{0};
- parallelForEach(symtab->getSymbols(), [&warningsCount](lld::macho::Symbol *sym) {
+ parallelForEach(symtab->getSymbols(), [&warningsCount](
+ lld::macho::Symbol *sym) {
if (auto *defined = dyn_cast<Defined>(sym)) {
if (config->exportedSymbols.match(sym->getName())) {
if (defined->privateExtern) {
@@ -1716,7 +1717,6 @@ static void resolveBitcodeProvidedSymbolsForTBDGeneration() {
lto->add(*bitcodeFile, /* forTBDGeneration */ true);
}
-
static void writeTBD(const StringRef outputPath) {
std::error_code errorCode;
llvm::raw_fd_ostream os(outputPath, errorCode, llvm::sys::fs::OF_Text);
diff --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 41a8eabd9..de54bede9 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -2343,8 +2343,7 @@ static macho::Symbol *createBitcodeSymbol(const lto::InputFile::Symbol &objSym,
/*isReferencedDynamically=*/false,
/*noDeadStrip=*/false,
/*isWeakDefCanBeHidden=*/false,
- /*isTlv*/ objSym.isTLS()
- );
+ /*isTlv*/ objSym.isTLS());
}
BitcodeFile::BitcodeFile(MemoryBufferRef mb, StringRef archiveName,
diff --git a/lld/MachO/LTO.cpp b/lld/MachO/LTO.cpp
index 8b2317dc1..67a0b2b49 100644
--- a/lld/MachO/LTO.cpp
+++ b/lld/MachO/LTO.cpp
@@ -159,8 +159,7 @@ void BitcodeCompiler::add(BitcodeFile &f, bool forTBDGeneration) {
// Un-define the symbol so that we don't get duplicate symbol errors when we
// load the ObjFile emitted by LTO compilation.
- if (r.Prevailing)
- {
+ if (r.Prevailing) {
// Symbol resolution for bitcode provided symbols works slightly
// differently from symbol resolution for native symbols. For
// every symbol occurence (the same symbol name may occur multiple times),
diff --git a/lld/MachO/SymbolTable.cpp b/lld/MachO/SymbolTable.cpp
index ba928761f..ef55cf2a3 100644
--- a/lld/MachO/SymbolTable.cpp
+++ b/lld/MachO/SymbolTable.cpp
@@ -104,9 +104,7 @@ Defined *SymbolTable::addDefined(StringRef name, InputFile *file,
uint64_t size, bool isWeakDef,
bool isPrivateExtern,
bool isReferencedDynamically, bool noDeadStrip,
- bool isWeakDefCanBeHidden,
- bool isTlv
-) {
+ bool isWeakDefCanBeHidden, bool isTlv) {
bool overridesWeakDef = false;
auto [s, wasInserted] = insert(name, file);
@@ -213,8 +211,7 @@ Defined *SymbolTable::addDefined(StringRef name, InputFile *file,
Defined *defined = replaceSymbol<Defined>(
s, name, file, isec, value, size, isWeakDef, /*isExternal=*/true,
isPrivateExtern, /*includeInSymtab=*/true, isReferencedDynamically,
- noDeadStrip, overridesWeakDef, isWeakDefCanBeHidden, interposable, isTlv
- );
+ noDeadStrip, overridesWeakDef, isWeakDefCanBeHidden, interposable, isTlv);
return defined;
}
diff --git a/lld/MachO/SymbolTable.h b/lld/MachO/SymbolTable.h
index e1d99c081..bf9479999 100644
--- a/lld/MachO/SymbolTable.h
+++ b/lld/MachO/SymbolTable.h
@@ -40,8 +40,7 @@ public:
uint64_t value, uint64_t size, bool isWeakDef,
bool isPrivateExtern, bool isReferencedDynamically,
bool noDeadStrip, bool isWeakDefCanBeHidden,
- bool isTlv = false
- );
+ bool isTlv = false);
Defined *aliasDefined(Defined *src, StringRef target, InputFile *newFile,
bool makePrivateExtern = false);
diff --git a/lld/MachO/Symbols.cpp b/lld/MachO/Symbols.cpp
index 5b5bd896f..38d82ae65 100644
--- a/lld/MachO/Symbols.cpp
+++ b/lld/MachO/Symbols.cpp
@@ -57,17 +57,14 @@ Defined::Defined(StringRef name, InputFile *file, InputSection *isec,
bool isPrivateExtern, bool includeInSymtab,
bool isReferencedDynamically, bool noDeadStrip,
bool canOverrideWeakDef, bool isWeakDefCanBeHidden,
- bool interposable,
- bool isTlv)
+ bool interposable, bool isTlv)
: Symbol(DefinedKind, name, file), overridesWeakDef(canOverrideWeakDef),
privateExtern(isPrivateExtern), includeInSymtab(includeInSymtab),
identicalCodeFoldingKind(ICFFoldKind::None),
referencedDynamically(isReferencedDynamically), noDeadStrip(noDeadStrip),
interposable(interposable), weakDefCanBeHidden(isWeakDefCanBeHidden),
weakDef(isWeakDef), external(isExternal), originalIsec(isec),
- value(value), size(size),
- tlv(isTlv)
-{
+ value(value), size(size), tlv(isTlv) {
if (isec) {
isec->symbols.push_back(this);
// Maintain sorted order.
diff --git a/lld/MachO/Symbols.h b/lld/MachO/Symbols.h
index 3ff35b74c..0cceb7f26 100644
--- a/lld/MachO/Symbols.h
+++ b/lld/MachO/Symbols.h
@@ -118,9 +118,7 @@ public:
uint64_t size, bool isWeakDef, bool isExternal, bool isPrivateExtern,
bool includeInSymtab, bool isReferencedDynamically, bool noDeadStrip,
bool canOverrideWeakDef = false, bool isWeakDefCanBeHidden = false,
- bool interposable = false,
- bool isTlv = false
- );
+ bool interposable = false, bool isTlv = false);
bool isWeakDef() const override { return weakDef; }
bool isExternalWeakDef() const {
``````````
</details>
https://github.com/llvm/llvm-project/pull/194899
More information about the llvm-commits
mailing list