Author: Jonas Devlieghere Date: 2020-04-16T15:35:51-07:00 New Revision: d10386e1779599d217b5b849a079f29dfbe17024
URL: https://github.com/llvm/llvm-project/commit/d10386e1779599d217b5b849a079f29dfbe17024 DIFF: https://github.com/llvm/llvm-project/commit/d10386e1779599d217b5b849a079f29dfbe17024.diff LOG: [lldb/Utility] Provide a stringify_append overload for function pointers. Converting a function pointer to an object pointer is illegal as nothing requires it to be in the same address space. Add an overload for function pointers so we don't convert do this illegal conversion, and simply print out "function pointer". Added: Modified: lldb/include/lldb/Utility/ReproducerInstrumentation.h Removed: ################################################################################ diff --git a/lldb/include/lldb/Utility/ReproducerInstrumentation.h b/lldb/include/lldb/Utility/ReproducerInstrumentation.h index 3b5dde3d2e2a..75f38929e362 100644 --- a/lldb/include/lldb/Utility/ReproducerInstrumentation.h +++ b/lldb/include/lldb/Utility/ReproducerInstrumentation.h @@ -34,12 +34,17 @@ inline void stringify_append(llvm::raw_string_ostream &ss, const T &t) { template <typename T> inline void stringify_append(llvm::raw_string_ostream &ss, T *t) { - ss << reinterpret_cast<void *>(t); + ss << static_cast<void *>(t); } template <typename T> inline void stringify_append(llvm::raw_string_ostream &ss, const T *t) { - ss << reinterpret_cast<const void *>(t); + ss << static_cast<const void *>(t); +} + +template <typename T, typename... Args> +inline void stringify_append(llvm::raw_string_ostream &ss, T (*t)(Args...)) { + ss << "function pointer"; } template <> _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits