This is an archive of the discontinued LLVM Phabricator instance.

[llvm] [Support] Clean PrintStackTrace() ptr arithmetic up
ClosedPublic

Authored by mgorny on Jun 27 2019, 12:21 PM.

Details

Summary

Use '%tu' modifier for pointer arithmetic since we are using C++11
already. Prefer static_cast<> over C-style cast. Remove unnecessary
conversion of result, and add const qualifier to converted pointers,
to silence the following warning:

In file included from /home/mgorny/llvm-project/llvm/lib/Support/Signals.cpp:220:0:
/home/mgorny/llvm-project/llvm/lib/Support/Unix/Signals.inc: In function ‘void llvm::sys::PrintStackTrace(llvm::raw_ostream&)’:
/home/mgorny/llvm-project/llvm/lib/Support/Unix/Signals.inc:546:53: warning: cast from type ‘const void*’ to type ‘char*’ casts away qualifiers [-Wcast-qual]
                                       (char*)dlinfo.dli_saddr));
                                                     ^~~~~~~~~

Diff Detail

Repository
rL LLVM

Event Timeline

mgorny created this revision.Jun 27 2019, 12:21 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: hiraditya. · View Herald Transcript
krytarowski accepted this revision.Jul 1 2019, 8:03 PM
This revision is now accepted and ready to land.Jul 1 2019, 8:03 PM
gribozavr accepted this revision.Jul 1 2019, 10:55 PM
This revision was automatically updated to reflect the committed changes.