This is an archive of the discontinued LLVM Phabricator instance.

[obj2yaml] Add -o to specify output filename
ClosedPublic

Authored by MaskRay on Jul 13 2022, 6:10 PM.

Details

Summary

-o is very common among tools. yaml2obj supports -o and it surprised me that
obj2yaml doesn't support -o. Just add it which doesn't take much code.

Diff Detail

Event Timeline

MaskRay created this revision.Jul 13 2022, 6:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 6:10 PM
Herald added a subscriber: StephenFan. · View Herald Transcript
MaskRay requested review of this revision.Jul 13 2022, 6:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 6:10 PM
jhenderson added inline comments.Jul 13 2022, 11:51 PM
llvm/test/tools/obj2yaml/Archives/regular.yaml
11–13

I wonder if we could avoid some test duplication in these test cases by doing the following pattern instead:

# RUN: obj2yaml %t.empty.a > %t.stdout.yaml
# RUN: obj2yaml %t.empty.a -o %t.file.yaml 2>&1 | count 0
# RUN: FileCheck --input-file=%t.stdout.yaml %s --check-prefix=EMPTY
# RUN: diff %t.stdout.yaml %t.file.yaml

What do you think?

The same sort of pattern could apply to the other test cases too.

llvm/tools/obj2yaml/obj2yaml.cpp
64

I guess there isn't an appropriate offloading test case you could update like you have with the others?

114

Should we have a test case that if there was an error, the output file is not kept? It seems like a simple extension to me.

MaskRay updated this revision to Diff 444538.Jul 14 2022, 12:25 AM
MaskRay marked 3 inline comments as done.

address comments

llvm/tools/obj2yaml/obj2yaml.cpp
64

Found a suitable test: updated llvm/test/ObjectYAML/Offload/default.yaml

jhenderson accepted this revision.Jul 14 2022, 12:28 AM

LGTM, thanks!

This revision is now accepted and ready to land.Jul 14 2022, 12:28 AM
This revision was landed with ongoing or failed builds.Jul 14 2022, 12:33 AM
This revision was automatically updated to reflect the committed changes.