[llvm] c2bf1ca - [llvm-objdump] Remove unnecessary casts (NFC) (#153128)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 11 22:51:51 PDT 2025


Author: Kazu Hirata
Date: 2025-08-11T22:51:48-07:00
New Revision: c2bf1ca4001508961aedc5c59e3d6f3b429c795f

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

LOG: [llvm-objdump] Remove unnecessary casts (NFC) (#153128)

Ptr is already of const char *.

Added: 
    

Modified: 
    llvm/tools/llvm-objdump/MachODump.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp
index 6dccf21fc72b0..8105a248a33be 100644
--- a/llvm/tools/llvm-objdump/MachODump.cpp
+++ b/llvm/tools/llvm-objdump/MachODump.cpp
@@ -9063,7 +9063,7 @@ static void PrintDyldLoadCommand(MachO::dylinker_command dyld,
   if (dyld.name >= dyld.cmdsize)
     outs() << "         name ?(bad offset " << dyld.name << ")\n";
   else {
-    const char *P = (const char *)(Ptr) + dyld.name;
+    const char *P = Ptr + dyld.name;
     outs() << "         name " << P << " (offset " << dyld.name << ")\n";
   }
 }
@@ -9094,7 +9094,7 @@ static void PrintRpathLoadCommand(MachO::rpath_command rpath, const char *Ptr) {
   if (rpath.path >= rpath.cmdsize)
     outs() << "         path ?(bad offset " << rpath.path << ")\n";
   else {
-    const char *P = (const char *)(Ptr) + rpath.path;
+    const char *P = Ptr + rpath.path;
     outs() << "         path " << P << " (offset " << rpath.path << ")\n";
   }
 }
@@ -10041,7 +10041,7 @@ static void PrintDylibCommand(MachO::dylib_command dl, const char *Ptr) {
   else
     outs() << "\n";
   if (dl.dylib.name < dl.cmdsize) {
-    const char *P = (const char *)(Ptr) + dl.dylib.name;
+    const char *P = Ptr + dl.dylib.name;
     outs() << "         name " << P << " (offset " << dl.dylib.name << ")\n";
   } else {
     outs() << "         name ?(bad offset " << dl.dylib.name << ")\n";


        


More information about the llvm-commits mailing list