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 -- 
clang/lib/Driver/ToolChains/Darwin.cpp 
clang/lib/InstallAPI/DiagnosticBuilderWrappers.cpp lld/MachO/Driver.cpp 
lld/MachO/InputSection.cpp lld/MachO/InputSection.h 
lld/MachO/SyntheticSections.cpp lld/MachO/SyntheticSections.h 
lld/MachO/Writer.cpp llvm/include/llvm/TextAPI/FileTypes.h 
llvm/lib/CodeGen/TargetPassConfig.cpp 
llvm/lib/TextAPI/BinaryReader/DylibReader.cpp --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/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index ed712535b..ee970b3d3 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -320,14 +320,14 @@ void darwin::Linker::AddLinkArgs(Compilation &C, const 
ArgList &Args,
                                                        << "-dynamiclib";
 
     if ((A = Args.getLastArg(options::OPT_fapple_kext))) {
-        CmdArgs.push_back("-kext");
-        CmdArgs.push_back("-undefined");
-        CmdArgs.push_back("dynamic_lookup");
+      CmdArgs.push_back("-kext");
+      CmdArgs.push_back("-undefined");
+      CmdArgs.push_back("dynamic_lookup");
     } else {
-        Args.AddLastArg(CmdArgs, options::OPT_bundle);
-        Args.AddAllArgs(CmdArgs, options::OPT_bundle__loader);
-        Args.AddLastArg(CmdArgs, options::OPT_force__flat__namespace);
-        Args.AddLastArg(CmdArgs, options::OPT_private__bundle);
+      Args.AddLastArg(CmdArgs, options::OPT_bundle);
+      Args.AddAllArgs(CmdArgs, options::OPT_bundle__loader);
+      Args.AddLastArg(CmdArgs, options::OPT_force__flat__namespace);
+      Args.AddLastArg(CmdArgs, options::OPT_private__bundle);
     }
 
     Args.AddAllArgs(CmdArgs, options::OPT_client__name);
@@ -4031,7 +4031,7 @@ void Darwin::addStartObjectFileArgs(const ArgList &Args,
   if (Args.hasArg(options::OPT_dynamiclib))
     addDynamicLibLinkArgs(*this, Args, CmdArgs);
   else if (Args.hasArg(options::OPT_fapple_kext))
-      CmdArgs.push_back("-kext"); // TODO ?
+    CmdArgs.push_back("-kext"); // TODO ?
   else if (Args.hasArg(options::OPT_bundle))
     addBundleLinkArgs(*this, Args, CmdArgs);
   else if (Args.hasArg(options::OPT_pg) && SupportsProfiling())
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index f44499b06..9b821deba 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -72,7 +72,8 @@ std::unique_ptr<DependencyTracker> macho::depTracker;
 
 static HeaderFileType getOutputType(const InputArgList &args) {
   // TODO: -r, -dylinker, -preload...
-  Arg *outputArg = args.getLastArg(OPT_kext, OPT_bundle, OPT_dylib, 
OPT_execute);
+  Arg *outputArg =
+      args.getLastArg(OPT_kext, OPT_bundle, OPT_dylib, OPT_execute);
   if (outputArg == nullptr)
     return MH_EXECUTE;
 
diff --git a/lld/MachO/InputSection.cpp b/lld/MachO/InputSection.cpp
index 14e75e9b2..2aa2836c4 100644
--- a/lld/MachO/InputSection.cpp
+++ b/lld/MachO/InputSection.cpp
@@ -247,7 +247,8 @@ void ConcatInputSection::writeTo(uint8_t *buf) {
       if (target->hasAttr(r.type, RelocAttrBits::LOAD) &&
           !referentSym->isInGot())
         target->relaxGotLoad(loc, r.type);
-      if (config->outputType == MH_KEXT_BUNDLE && !needsFixup && 
needsBinding(referentSym)) {
+      if (config->outputType == MH_KEXT_BUNDLE && !needsFixup &&
+          needsBinding(referentSym)) {
         if (target->hasAttr(r.type, RelocAttrBits::BRANCH)) {
           continue;
         }
diff --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index 87697afba..29fec8b1c 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -106,12 +106,14 @@ static uint32_t cpuSubtype() {
 
 static bool hasWeakBinding() {
   return config->emitChainedFixups ? in.chainedFixups->hasWeakBinding()
-                                   : config->outputType != MH_KEXT_BUNDLE && 
in.weakBinding->hasEntry();
+                                   : config->outputType != MH_KEXT_BUNDLE &&
+                                         in.weakBinding->hasEntry();
 }
 
 static bool hasNonWeakDefinition() {
   return config->emitChainedFixups ? in.chainedFixups->hasNonWeakDefinition()
-                                   : config->outputType != MH_KEXT_BUNDLE && 
in.weakBinding->hasNonWeakDefinition();
+                                   : config->outputType != MH_KEXT_BUNDLE &&
+                                         
in.weakBinding->hasNonWeakDefinition();
 }
 
 void MachHeaderSection::writeTo(uint8_t *buf) const {
@@ -320,10 +322,10 @@ void macho::addNonLazyBindingEntries(const Symbol *sym,
   if (config->outputType == MH_KEXT_BUNDLE) {
     if (needsBinding(sym))
       in.extRelocs->addEntry(sym, isec, offset, target->unsignedRelocType,
-                              /*pcrel=*/false, target->p2WordSize);
+                             /*pcrel=*/false, target->p2WordSize);
     else if (isa<Defined>(sym))
       in.localRelocs->addEntry(sym, isec, offset, target->unsignedRelocType,
-                              /*pcrel=*/false, target->p2WordSize);
+                               /*pcrel=*/false, target->p2WordSize);
     else
       llvm_unreachable("cannot bind to an undefined symbol");
     return;
@@ -828,7 +830,7 @@ void StubHelperSection::setUp() {
   dyldPrivate->used = true;
 }
 
-RelocSection::RelocSection(const char* name)
+RelocSection::RelocSection(const char *name)
     : LinkEditSection(segment_names::linkEdit, name) {}
 
 void RelocSection::writeTo(uint8_t *buf) const {
@@ -847,10 +849,10 @@ void RelocSection::writeTo(uint8_t *buf) const {
 
     write32le(buf + sizeof(uint32_t),
               (symOrSectNum & 0x00ffffffu) |
-              (static_cast<uint32_t>(e.pcrel)  << 24) |
-              (static_cast<uint32_t>(e.length) << 25) |
-              (static_cast<uint32_t>(ext)      << 27) |
-              (static_cast<uint32_t>(e.type)   << 28));
+                  (static_cast<uint32_t>(e.pcrel) << 24) |
+                  (static_cast<uint32_t>(e.length) << 25) |
+                  (static_cast<uint32_t>(ext) << 27) |
+                  (static_cast<uint32_t>(e.type) << 28));
 
     buf += sizeof(uint32_t) * 2;
   }
@@ -1527,7 +1529,8 @@ IndirectSymtabSection::IndirectSymtabSection()
 uint32_t IndirectSymtabSection::getNumSymbols() const {
   uint32_t size = in.got->getEntries().size();
   if (config->outputType != MH_KEXT_BUNDLE)
-    size += in.tlvPointers->getEntries().size() + 
in.stubs->getEntries().size() * (config->emitChainedFixups ? 1 : 2);
+    size += in.tlvPointers->getEntries().size() +
+            in.stubs->getEntries().size() * (config->emitChainedFixups ? 1 : 
2);
   return size;
 }
 
diff --git a/lld/MachO/SyntheticSections.h b/lld/MachO/SyntheticSections.h
index 73517fd1a..504fa14e9 100644
--- a/lld/MachO/SyntheticSections.h
+++ b/lld/MachO/SyntheticSections.h
@@ -304,9 +304,11 @@ class RelocSection : public LinkEditSection {
 public:
   RelocSection(const char *name);
   bool isNeeded() const override { return !entries.empty(); }
-  uint64_t getRawSize() const override { return entries.size() * 
(sizeof(uint32_t) * 2); }
-  void addEntry(const Symbol *sym, const InputSection *isec,
-                uint32_t offset, uint8_t type, bool pcrel, uint8_t length) {
+  uint64_t getRawSize() const override {
+    return entries.size() * (sizeof(uint32_t) * 2);
+  }
+  void addEntry(const Symbol *sym, const InputSection *isec, uint32_t offset,
+                uint8_t type, bool pcrel, uint8_t length) {
     entries.emplace_back(sym, isec, offset, type, pcrel, length);
   }
   void writeTo(uint8_t *buf) const override;
@@ -317,14 +319,14 @@ public:
     const Symbol *sym;
     const InputSection *isec;
     uint32_t offset;
-    uint8_t  type;
-    bool     pcrel;
-    uint8_t  length;
-
-    Entry(const Symbol *sym, const InputSection *isec,
-                uint32_t offset, uint8_t type, bool pcrel, uint8_t length)
-        : sym(sym), isec(isec), offset(offset), type(type), pcrel(pcrel), 
length(length)
-    { }
+    uint8_t type;
+    bool pcrel;
+    uint8_t length;
+
+    Entry(const Symbol *sym, const InputSection *isec, uint32_t offset,
+          uint8_t type, bool pcrel, uint8_t length)
+        : sym(sym), isec(isec), offset(offset), type(type), pcrel(pcrel),
+          length(length) {}
   };
   std::vector<Entry> entries;
 };
diff --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index bbe1542ac..936dea865 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -216,11 +216,11 @@ public:
     // For kext bundles
     if (in.extRelocs && in.extRelocs->isNeeded()) {
       c->extreloff = in.extRelocs->fileOff;
-      c->nextrel   = in.extRelocs->entries.size();
+      c->nextrel = in.extRelocs->entries.size();
     }
     if (in.localRelocs && in.localRelocs->isNeeded()) {
       c->locreloff = in.localRelocs->fileOff;
-      c->nlocrel   = in.localRelocs->entries.size();
+      c->nlocrel = in.localRelocs->entries.size();
     }
   }
 
@@ -689,11 +689,11 @@ static void prepareSymbolRelocation(Symbol *sym, const 
InputSection *isec,
 
   if (relocAttrs.hasAttr(RelocAttrBits::BRANCH)) {
     if (needsBinding(sym)) {
-        if (config->outputType == MH_KEXT_BUNDLE) {
-          in.extRelocs->addEntry(sym, isec, r.offset, r.type, r.pcrel, 
r.length);
-        } else {
-          in.stubs->addEntry(sym);
-        }
+      if (config->outputType == MH_KEXT_BUNDLE) {
+        in.extRelocs->addEntry(sym, isec, r.offset, r.type, r.pcrel, r.length);
+      } else {
+        in.stubs->addEntry(sym);
+      }
     }
   } else if (relocAttrs.hasAttr(RelocAttrBits::GOT)) {
     if (relocAttrs.hasAttr(RelocAttrBits::POINTER) || needsBinding(sym))
@@ -757,7 +757,8 @@ void Writer::scanRelocations() {
           if (config->emitChainedFixups)
             in.chainedFixups->addRebase(isec, r.offset);
           else if (config->outputType == MH_KEXT_BUNDLE)
-            in.localRelocs->addEntry(sym, isec, r.offset, r.type, false, 
r.length);
+            in.localRelocs->addEntry(sym, isec, r.offset, r.type, false,
+                                     r.length);
           else
             in.rebase->addEntry(isec, r.offset);
         }
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp 
b/llvm/lib/CodeGen/TargetPassConfig.cpp
index 3921f5870..652c15230 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -874,7 +874,8 @@ void TargetPassConfig::addIRPasses() {
 
   // // For MachO, lower @llvm.global_dtors into @llvm.global_ctors with
   // // __cxa_atexit() calls to avoid emitting the deprecated __mod_term_func.
-  // if (!DisableAtExitBasedGlobalDtorLowering && 
TM->getTargetTriple().isOSBinFormatMachO())
+  // if (!DisableAtExitBasedGlobalDtorLowering &&
+  // TM->getTargetTriple().isOSBinFormatMachO())
   //   addPass(createLowerGlobalDtorsLegacyPass());
 
   // Make sure that no unreachable blocks are instruction selected.

``````````

</details>


https://github.com/llvm/llvm-project/pull/204805
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to