This is an archive of the discontinued LLVM Phabricator instance.

[Object] Deduplicate the three createError functions
ClosedPublic

Authored by teemperor on Oct 11 2021, 6:06 AM.

Details

Summary

The Object library currently has three identical functions that translate a Twine into
a parser error. Until recently these functions have coexisted peacefully, but since
D110320 Clang with enabled modules is now diagnosing that we have several definitions
of createError in Object.

This patch just merges them all and puts them into Object's Error.h where the error
code for parse_failed is also defined which seems cleaner and unbreaks the bots.

Diff Detail

Event Timeline

teemperor created this revision.Oct 11 2021, 6:06 AM
teemperor requested review of this revision.Oct 11 2021, 6:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2021, 6:06 AM
teemperor edited the summary of this revision. (Show Details)Oct 11 2021, 6:08 AM
jsji added a reviewer: Esme.Oct 11 2021, 6:40 AM
jhenderson added inline comments.Oct 11 2021, 6:41 AM
llvm/include/llvm/Object/Error.h
85

I'm not sure you want the static keyword here? The inline keyword is enough to prevent ODR violations.

teemperor updated this revision to Diff 378659.Oct 11 2021, 7:21 AM
  • Remove static
llvm/include/llvm/Object/Error.h
85

Thanks! (this is actually just ELF.h version copied here, but the static can indeed go).

This revision is now accepted and ready to land.Oct 11 2021, 7:24 AM
This revision was landed with ongoing or failed builds.Oct 11 2021, 7:37 AM
This revision was automatically updated to reflect the committed changes.