[lld] 4f80508 - [lld] Add explicit conversion for enum to Twine. (#100627)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 11:37:34 PDT 2024


Author: Scott Todd
Date: 2024-07-25T11:37:31-07:00
New Revision: 4f8050806e14d9f7791bfaa33681cacb1ac02549

URL: https://github.com/llvm/llvm-project/commit/4f8050806e14d9f7791bfaa33681cacb1ac02549
DIFF: https://github.com/llvm/llvm-project/commit/4f8050806e14d9f7791bfaa33681cacb1ac02549.diff

LOG: [lld] Add explicit conversion for enum to Twine. (#100627)

This fixes `error: ambiguous conversion for functional-style cast from
'lld::macho::InputSection::Kind' to 'llvm::Twine'`, observed when
building with clang-9 and reported here:
https://github.com/llvm/llvm-project/pull/96268#discussion_r1691909931.

Added: 
    

Modified: 
    lld/MachO/BPSectionOrderer.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index 26d4e0cb3987d..f6a974370836b 100644
--- a/lld/MachO/BPSectionOrderer.cpp
+++ b/lld/MachO/BPSectionOrderer.cpp
@@ -48,9 +48,9 @@ getRelocHash(const Reloc &reloc,
     sectionIdx = sectionIdxIt->getSecond();
   std::string kind;
   if (isec)
-    kind = ("Section " + Twine(isec->kind())).str();
+    kind = ("Section " + Twine((uint8_t)isec->kind())).str();
   if (auto *sym = reloc.referent.dyn_cast<Symbol *>()) {
-    kind += (" Symbol " + Twine(sym->kind())).str();
+    kind += (" Symbol " + Twine((uint8_t)sym->kind())).str();
     if (auto *d = dyn_cast<Defined>(sym)) {
       if (isa_and_nonnull<CStringInputSection>(isec))
         return getRelocHash(kind, 0, isec->getOffset(d->value), reloc.addend);


        


More information about the llvm-commits mailing list