This is an archive of the discontinued LLVM Phabricator instance.

Bug 30934 - YAML error not reported by ``yaml::Input::error()``
ClosedPublic

Authored by serge-sans-paille on Nov 8 2016, 1:21 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

serge-sans-paille retitled this revision from to Bug 30934 - YAML error not reported by ``yaml::Input::error()``.
serge-sans-paille updated this object.
serge-sans-paille added a reviewer: mehdi_amini.
serge-sans-paille set the repository for this revision to rL LLVM.
serge-sans-paille added a subscriber: llvm-commits.
mehdi_amini added inline comments.Nov 14 2016, 10:01 PM
lib/Support/YAMLTraits.cpp
115 ↗(On Diff #77249)

So it seems that any error checking on Input should also check on the Stream itself. It may be less error prone to refactor this check into a single method and turn all the tests into if (hasError()) return;

Refactoring done!

serge-sans-paille marked an inline comment as done.Nov 15 2016, 6:29 AM
serge-sans-paille added inline comments.
lib/Support/YAMLTraits.cpp
115 ↗(On Diff #77249)

That's my feeling too. I did the proposed refactoring, putting the method as private to prevent semantic conflict with the public error() method.

mehdi_amini accepted this revision.Nov 15 2016, 9:08 AM
mehdi_amini edited edge metadata.

Thanks, LGTM.

This revision is now accepted and ready to land.Nov 15 2016, 9:08 AM
This revision was automatically updated to reflect the committed changes.
mehdi_amini reopened this revision.Nov 27 2016, 9:07 PM

Serge: the unittest is not passing, can you have a look?

This revision is now accepted and ready to land.Nov 27 2016, 9:07 PM
serge-sans-paille edited edge metadata.
serge-sans-paille marked an inline comment as done.

This patch seemsmore robust: when a subcomponent reports an error, it may set the parent error_code.

Different system, different header deps; I made this one explicit.

This revision was automatically updated to reflect the committed changes.