This is an archive of the discontinued LLVM Phabricator instance.

Add MachOObjectFile::getUuid()
ClosedPublic

Authored by glider on Oct 13 2014, 5:46 AM.

Details

Summary

This CL introduces MachOObjectFile::getUuid(). This function returns an ArrayRef to the object file's UUID, or an empty ArrayRef if the object file doesn't contain an LC_UUID load command.
The new function is gonna be used by llvm-symbolizer.

Diff Detail

Event Timeline

glider updated this revision to Diff 14797.Oct 13 2014, 5:46 AM
glider retitled this revision from to Add MachOObjectFile::findAndGetUuidCommand (better name suggestions welcome).
glider updated this object.
glider edited the test plan for this revision. (Show Details)
glider added reviewers: kledzik, rafael.
glider added a subscriber: Unknown Object (MLST).
kledzik edited edge metadata.Oct 13 2014, 9:46 AM

The MachOObjectFile constructor is already walking the load commands. If there is a LC_UUID, you can have the constructor save it off in an ivar.

The name findAndGetUuidCommand() is different than the other methods. Can it just be getUUID() and have it return the 16-bytes? Perhaps an ArrayRef<uint8_t> that has zero length if there is no UUID? Seems like that would be more convenient for the client.

-Nick

glider updated this revision to Diff 14864.Oct 14 2014, 6:48 AM
glider retitled this revision from Add MachOObjectFile::findAndGetUuidCommand (better name suggestions welcome) to Add MachOObjectFile::getUuid().
glider updated this object.
glider edited edge metadata.

Addressed Nick's comments.

samsonov accepted this revision.Oct 14 2014, 11:03 AM
samsonov added a reviewer: samsonov.
This revision is now accepted and ready to land.Oct 14 2014, 11:03 AM
glider closed this revision.Oct 15 2014, 4:47 PM

r219866, thanks!