This is an archive of the discontinued LLVM Phabricator instance.

Implement some methods for NativeRawSymbol
ClosedPublic

Authored by amccarth on Feb 23 2017, 3:29 PM.

Details

Summary

This allows the ability to call IPDBSession::getGlobalScope with a NativeSession and
to then query it for some basic fields via the PDB's InfoStream.

Note that the symbols now have non-const references back to the Session so that
NativeRawSymbol can access the PDBFile through the Session.

Diff Detail

Repository
rL LLVM

Event Timeline

amccarth created this revision.Feb 23 2017, 3:29 PM
zturner added inline comments.Feb 23 2017, 3:37 PM
llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h
24–26 ↗(On Diff #89576)

Is the Path here necessary? The PDBFile` class is constructed with a Path, and you can query it via getFilePath().

llvm/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp
70 ↗(On Diff #89576)

If it fails, then IS is going to have an Error in it. And if it does, this is going to assert / crash if you don't explicitly handle the error. Usually I do something like this:

if (IS)
  return IS->getAge();
return IS.takeError();

But in this case you have nowhere to propagate the error to, so instead you can write consumeError(IS.takeError()); return 0;

Granted, silently throwing away errors is not ideal, but I don't see any solution to this unless you verify that it exists when you construct the NativeRawSymbol.

337 ↗(On Diff #89576)

Same problem here.

amccarth marked 3 inline comments as done.Feb 23 2017, 4:03 PM

Thanks for the tips on how to handle the Expected. From the description, I had the impression that it was only necessary to check for the error.

llvm/include/llvm/DebugInfo/PDB/Native/NativeSession.h
24–26 ↗(On Diff #89576)

Now that I've re-based I see it. Done.

amccarth updated this revision to Diff 89581.Feb 23 2017, 4:04 PM
amccarth marked an inline comment as done.

Addressed zturner's comments and rebased.

zturner accepted this revision.Feb 23 2017, 4:14 PM
This revision is now accepted and ready to land.Feb 23 2017, 4:14 PM
This revision was automatically updated to reflect the committed changes.