This is an archive of the discontinued LLVM Phabricator instance.

[API] Have SBCommandReturnObject::GetOutput/Error return "" instead of nullptr
ClosedPublic

Authored by labath on Aug 5 2019, 5:34 AM.

Details

Summary

It seems this was an unintended side-effect of D26698. AFAICT, these
functions did return an empty string before that patch, and the patch
contained code which attempted to ensure that, but those efforts were
negated by ConstString::AsCString, which by default returns a nullptr
even for empty strings.

This patch:

  • fixes the GetOutput/Error methods to really return empty strings
  • adds and explicit test for that
  • removes a workaround in lldbtest.py, which was masking this problem from our other tests

Diff Detail

Repository
rL LLVM

Event Timeline

labath created this revision.Aug 5 2019, 5:34 AM

Any thoughts on this one? The fix seems quite straight-forward, but I know there was a lot of discussion about None vs "" in the past (and I unfortunately don't remember the outcome of that, nor I was able to find those discussions), so I want to make sure I'm doing the right thing here...

clayborg accepted this revision.Aug 13 2019, 9:51 AM
This revision is now accepted and ready to land.Aug 13 2019, 9:51 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2019, 1:13 AM