<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - abuse of YAMLTraits' LLVM_YAML_IS_SEQUENCE_VECTOR and LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR causing many ODR violations"
   href="https://bugs.llvm.org/show_bug.cgi?id=33650">33650</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>abuse of YAMLTraits' LLVM_YAML_IS_SEQUENCE_VECTOR and LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR causing many ODR violations
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Support Libraries
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>richard-llvm@metafoo.co.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>kledzik@apple.com, llvm-bugs@lists.llvm.org, zturner@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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).</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>