This is an archive of the discontinued LLVM Phabricator instance.

[llvm] Fix ODRViolations for VersionTuple YAML specializations NFC
ClosedPublic

Authored by cishida on Oct 19 2020, 10:21 PM.

Details

Summary

It appears for Swift there was confusing errors when trying to parse APINotes, when libAPINotes and libInterfaceStub are linked, they both export symbol
__ZN4llvm4yaml7yamlizeINS_12VersionTupleEEENSt3__19enable_ifIXsr16has_ScalarTraitsIT_EE5valueEvE4typeERNS0_2IOERS5_bRNS0_12EmptyContextE, and discovered
same symbol defined within llvm-ifs.

This consolidates the boilerplate into YAMLTraits and defers the specific validation in reading the whole input.
fixes: rdar://problem/70450563

Diff Detail

Event Timeline

cishida created this revision.Oct 19 2020, 10:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 19 2020, 10:21 PM
cishida requested review of this revision.Oct 19 2020, 10:21 PM

Alternatively - if two places in the project need a ScalarTraits for VersionTuple, perhaps we should implement that in one central place (either near VersionTuple or ScalarTraits or, if necessary, in some 3rd utility location that can be include/used by those who depend on both (if there's code that really needs to be able to depend on either one without always depending on both))

I think I am overall ok with this for now until the TBE folks post some more patches to integrate ifs and tbe.

cishida updated this revision to Diff 299450.Oct 20 2020, 1:13 PM

Address dblaikie's suggestion and move specialization into YAMLTraits.

cishida edited the summary of this revision. (Show Details)Oct 20 2020, 1:19 PM
dblaikie accepted this revision.Oct 20 2020, 2:31 PM

Looks good to me

This revision is now accepted and ready to land.Oct 20 2020, 2:31 PM

Thanks for fixing this @cishida!

phosek accepted this revision.Oct 20 2020, 5:24 PM

LGTM

This revision was landed with ongoing or failed builds.Oct 20 2020, 6:30 PM
This revision was automatically updated to reflect the committed changes.