<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 - pass names > with break llvm::PrintStatisticsJSON()"
   href="https://bugs.llvm.org/show_bug.cgi?id=43812">43812</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>pass names > with  break llvm::PrintStatisticsJSON()
          </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>andres@anarazel.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>francisvm@yahoo.com, llvm-bugs@lists.llvm.org, matze@braunis.de
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi,

<a href="https://reviews.llvm.org/D41290">https://reviews.llvm.org/D41290</a> / r320996 / b213b27ee3cb changed
llvm::PrintStatisticsJSON() to assert yaml::QuotingType::None while making
needsQuotes() considerably more strict than before.

It was clearly too lenient in general before, but now the check fires in a lot
of cases where it's not necessary:

    void TimerGroup::printJSONValue(raw_ostream &OS, const PrintRecord &R,
                                    const char *suffix, double Value) {
      assert(yaml::needsQuotes(Name) == yaml::QuotingType::None &&
             "TimerGroup name should not need quotes");
      assert(yaml::needsQuotes(R.Name) == yaml::QuotingType::None &&
             "Timer name should not need quotes");
      constexpr auto max_digits10 = std::numeric_limits<double>::max_digits10;
      OS << "\t\"time." << Name << '.' << R.Name << suffix
         << "\": " << format("%.*e", max_digits10 - 1, Value);
    }

now asserts out for pass names like "X86 DAG->DAG Instruction Selection", as
yaml::needsQuotes treats the > thatin  as a quote needing character. In this
context that's clearly not necessary, as R.Name is printed within double
quotes.

Before <a href="https://reviews.llvm.org/D25588">https://reviews.llvm.org/D25588</a> / r287370 / db39fd6c53f8 the code
basically only checked whether the string contained a quote or non-printable
character. The change to yaml::needsQuotes may have worked at the time, but is
clearly not semantically the right thing.

This is obviously pretty easy to fix, I'm just not quite sure which possible
fix is the right one. Among the possibilities:
1) just remove the asserts
2) go back to an open coded assertion
3) Use JSON.h to add the quotes, rather than doing so manually.

- Andres

- Andres</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>