This is an archive of the discontinued LLVM Phabricator instance.

Object: Add IRObjectFile::getTargetTriple().
ClosedPublic

Authored by pcc on Nov 23 2016, 4:09 PM.

Details

Summary

This lets us remove a use of IRObjectFile::getModule() in llvm-nm.

Depends on D27073

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 79166.Nov 23 2016, 4:09 PM
pcc retitled this revision from to Object: Add IRObjectFile::getTargetTriple()..
pcc updated this object.
pcc added a reviewer: mehdi_amini.
pcc added subscribers: llvm-commits, rafael.
mehdi_amini accepted this revision.Nov 23 2016, 4:42 PM
mehdi_amini edited edge metadata.

LGTM.

llvm/tools/llvm-nm/llvm-nm.cpp
273 ↗(On Diff #79166)

A bit more concise:

auto TripleStr = IRobj->getTargetTriple()
if (TripleStr.empty)
  return false;
return Triple(TripleStr).isArch64Bit();

Or even:

auto TripleStr = IRobj->getTargetTriple()
return !TripleStr.empty() && Triple(TripleStr).isArch64Bit();
This revision is now accepted and ready to land.Nov 23 2016, 4:42 PM
pcc added inline comments.Nov 23 2016, 5:22 PM
llvm/tools/llvm-nm/llvm-nm.cpp
273 ↗(On Diff #79166)

In fact we don't need to test TripleStr for emptiness because isArch64Bit will return false given an empty triple. So I committed an even shorter version.

This revision was automatically updated to reflect the committed changes.