This is an archive of the discontinued LLVM Phabricator instance.

[Coverity] Fix unchecked return value, NFC
Needs ReviewPublic

Authored by pengfei on May 15 2023, 7:08 AM.

Details

Diff Detail

Unit TestsFailed

Event Timeline

pengfei created this revision.May 15 2023, 7:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2023, 7:08 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
pengfei requested review of this revision.May 15 2023, 7:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2023, 7:08 AM

@barannikov88 I still think [[nodiscard]] and (void) are a great couple for functions we care of the return value much rather than a contradication. The (void) tells compiler we are intended to do so here. This looks much better than we comment it like above everywhere.

barannikov88 added inline comments.May 15 2023, 7:22 AM
llvm/lib/ObjectYAML/ELFEmitter.cpp
73

If viewed without a context, I would say that this should either take an action on the result of checkLimit, or the function should not me marked [[nodiscard]].
Considering the context, and the use of Error class in particular, I'm not sure this would be the correct fix.
I would suggest requesting a review from someone who is more familiar with this (not really my area).

pengfei added inline comments.
llvm/lib/ObjectYAML/ELFEmitter.cpp
73

Sure, adding @grimar to have a look.