[llvm] r257932 - [Orc] Remove some reinterpret casts in debugging output.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 13:14:06 PST 2016


Author: lhames
Date: Fri Jan 15 15:14:05 2016
New Revision: 257932

URL: http://llvm.org/viewvc/llvm-project?rev=257932&view=rev
Log:
[Orc] Remove some reinterpret casts in debugging output.

These casts were from function pointer to data pointer type, which some
compilers (including GCC) may warn about. In all cases where these casts were
used the original value was still available as a TargetAddress (uint64_t), so
we can just print a formatted version of that instead.

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h?rev=257932&r1=257931&r2=257932&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h Fri Jan 15 15:14:05 2016
@@ -191,9 +191,7 @@ private:
     IntVoidFnTy Fn =
         reinterpret_cast<IntVoidFnTy>(static_cast<uintptr_t>(Addr));
 
-    DEBUG(dbgs() << "  Calling "
-                 << reinterpret_cast<void *>(reinterpret_cast<intptr_t>(Fn))
-                 << "\n");
+    DEBUG(dbgs() << "  Calling " << format("0x%016x", Addr) << "\n");
     int Result = Fn();
     DEBUG(dbgs() << "  Result = " << Result << "\n");
 
@@ -212,7 +210,7 @@ private:
     for (auto &Arg : Args)
       ArgV[Idx++] = Arg.c_str();
 
-    DEBUG(dbgs() << "  Calling " << reinterpret_cast<void *>(Fn) << "\n");
+    DEBUG(dbgs() << "  Calling " << format("0x%016x", Addr) << "\n");
     int Result = Fn(ArgC, ArgV.get());
     DEBUG(dbgs() << "  Result = " << Result << "\n");
 
@@ -224,7 +222,7 @@ private:
     VoidVoidFnTy Fn =
         reinterpret_cast<VoidVoidFnTy>(static_cast<uintptr_t>(Addr));
 
-    DEBUG(dbgs() << "  Calling " << reinterpret_cast<void *>(Fn) << "\n");
+    DEBUG(dbgs() << "  Calling " << format("0x%016x", Addr) << "\n");
     Fn();
     DEBUG(dbgs() << "  Complete.\n");
 
@@ -375,7 +373,7 @@ private:
     char *Src = reinterpret_cast<char *>(static_cast<uintptr_t>(RSrc));
 
     DEBUG(dbgs() << "  Reading " << Size << " bytes from "
-                 << static_cast<void *>(Src) << "\n");
+                 << format("0x%016x", RSrc) << "\n");
 
     if (auto EC = call<ReadMemResponse>(Channel))
       return EC;




More information about the llvm-commits mailing list