[llvm-bugs] [Bug 33650] New: abuse of YAMLTraits' LLVM_YAML_IS_SEQUENCE_VECTOR and LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR causing many ODR violations
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Jun 29 17:45:11 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=33650
Bug ID: 33650
Summary: abuse of YAMLTraits' LLVM_YAML_IS_SEQUENCE_VECTOR and
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR causing many ODR
violations
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Support Libraries
Assignee: unassignedbugs at nondot.org
Reporter: richard-llvm at metafoo.co.uk
CC: kledzik at apple.com, llvm-bugs at lists.llvm.org,
zturner at google.com
We have a large number of places in LLVM and a few in lld and clang-tools-extra
that do things like this:
LLVM_YAML_IS_SEQUENCE_VECTOR(StringRef)
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(uint64_t)
This is ridiculous: this specializes a global trait on a global type, and is
not something that an individual source file has any place doing.
Worse, different source files attempt to specialize the same trait in different
ways (as flow / non-flow sequence), leading to ODR violations and particularly
to the wrong formatting being used at runtime if the differing parts are not
inlined away.
These ODR violations are currently causing the modules build bots to fail.
The best way forward seems to be to pick a style (flow / non-flow) for
sequences of all scalar types and of string / StringRef, specialize the traits
for that style centrally (in YAMLTraits.h), and remove all the other
specializations.
For scalar types, all current code seems to agree that flow style is best. For
string types, across LLVM and its subprojects, we have 7 votes for block style
and 6 votes for flow style. That's not really consensus, but block style seems
likely to deal with long strings better, so I think we should go with that
(code that wants a different choice gets to define its own type).
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170630/bf6649ce/attachment-0001.html>
More information about the llvm-bugs
mailing list