This is an archive of the discontinued LLVM Phabricator instance.

fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
ClosedPublic

Authored by rsmith on Jun 30 2017, 1:38 PM.

Details

Summary

This is a short-term fix for PR33650 aimed to get the modules build bots green again.

Remove all the places where we use the LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR macros to try to locally specialize a global template for a global type. That's not how C++ works.

Instead, we now centrally define how to format vectors of fundamental types and of string (std::string and StringRef). We use flow formatting for the former cases, since that's the obvious right thing to do; in the latter case, it's less clear what the right choice is, but flow formatting is really bad for some cases (due to very long strings), so we pick block formatting. (Many of the cases that were using flow formatting for strings are improved by this change.)

Other than the flow -> block formatting change for some vectors of strings, this should result in no functionality change.

Diff Detail

Repository
rL LLVM

Event Timeline

rsmith created this revision.Jun 30 2017, 1:38 PM
zturner accepted this revision.Jun 30 2017, 1:51 PM

I don't have any comments, this seems fine to me. Long term I think the best solution is to get rid of these global specializations entirely, and instead provide adapters called flow and block, and instead of just saying IO.mapOptional("Foo", Sequence); and having it be picked up by a specialization, you would say IO.mapOptional("Foo", flow(Sequence));

This revision is now accepted and ready to land.Jun 30 2017, 1:51 PM
rsmith edited the summary of this revision. (Show Details)Jun 30 2017, 1:52 PM
This revision was automatically updated to reflect the committed changes.

Committed as r306878-360881.