This is an archive of the discontinued LLVM Phabricator instance.

[DWARF] Refactor callback usage for .debug_line error handling
ClosedPublic

Authored by jhenderson on May 14 2018, 7:27 AM.

Details

Summary

As suggested by @JDevlieghere, I have switched the callback that takes a string in the debug line error handling, with one that takes an Error. This allows using the same default function for both recoverable and unrecoverable errors. Further, to more clearly define which is which, I have renamed the two callbacks.

There are also some other minor tidy-ups/simplifications in relation to this change.

Diff Detail

Repository
rL LLVM

Event Timeline

jhenderson created this revision.May 14 2018, 7:27 AM
JDevlieghere accepted this revision.May 16 2018, 2:06 AM

Thanks James, this LGTM!

This revision is now accepted and ready to land.May 16 2018, 2:06 AM

Fixed a build breakage (I forgot to update DwarfLinker.cpp). Also silenced a warning produced by GCC 4.8 and fixed a bug in the unit tests (the recordRecoverable function was using joinErrors on the wrong input).

jhenderson requested review of this revision.May 16 2018, 4:38 AM

Hi all. I wanted to get feedback on one of the changes I had to make in order to not get a warning from at least GCC 4.8.4 (the version I use to build with on Linux). Specifically, I've added a createError overload that only takes a char const *, for messages that require no additional formatting. Specifically, this is used by the only recoverable error. Prior to this, I was getting (in my opinion spurious) warnings regarding the format not being a string literal and no arguments being provided from the depths of Format.h (something to do with the way snprintf is used within the format object). I'm not sure what was wrong with my usage of format in formatErrorString when the variadic template list is empty, but this was the easiest way I could come up with to resolve it. Other suggestions are more than welcome!

Hi all. I wanted to get feedback on one of the changes I had to make in order to not get a warning from at least GCC 4.8.4 (the version I use to build with on Linux). Specifically, I've added a createError overload that only takes a char const *, for messages that require no additional formatting. Specifically, this is used by the only recoverable error. Prior to this, I was getting (in my opinion spurious) warnings regarding the format not being a string literal and no arguments being provided from the depths of Format.h (something to do with the way snprintf is used within the format object). I'm not sure what was wrong with my usage of format in formatErrorString when the variadic template list is empty, but this was the easiest way I could come up with to resolve it. Other suggestions are more than welcome!

Sounds reasonable to me.

This revision was not accepted when it landed; it landed in state Needs Review.May 21 2018, 8:34 AM
This revision was automatically updated to reflect the committed changes.