<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 - Editor placeholder check is too lax"
   href="https://bugs.llvm.org/show_bug.cgi?id=33394">33394</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Editor placeholder check is too lax
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mistydemeo@github.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18606" name="attach_18606" title="Proposed patch to improve editor placeholder check">attachment 18606</a> <a href="attachment.cgi?id=18606&action=edit" title="Proposed patch to improve editor placeholder check">[details]</a></span>
Proposed patch to improve editor placeholder check

The new support for editor placeholders, added in
aac41bcdb19f21fb20a2efdc19494b622ba29171, is too lax in its definition of
editor placeholders. I noticed this when the current check (begins with "<#"
and ends with "#>") caught <#> (a Haskell operator) in some Haskell with GHC,
uses the C preprocessor for certain Haskell code. According to the comment in
IdentifierTable.h, editor placeholders are "characters between '<#' and '#>'",
for example "<#int x#>" - this shouldn't be matching <#>.

The attached patch adds an extra check to see if the matched code has more than
one #, in addition to checking the beginning and ending of the string. I'm not
sure if the additions to the test in my patch are an appropriate way to check
for this - please let me know if there's something else you'd rather see.

A sample error, as reported at <a href="https://ghc.haskell.org/trac/ghc/ticket/13805">https://ghc.haskell.org/trac/ghc/ticket/13805</a>
(before I identified the source of the problem) is:

utils/ghc-pkg/Main.hs:1269:40: error:
     error: editor placeholder in source file
               then termText (location db) <#> termText "\n    (no packages)\n"
                                           ^</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>