<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 - preprocessor fails to resolve directives in keepComments mode"
   href="https://bugs.llvm.org/show_bug.cgi?id=49017">49017</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>preprocessor fails to resolve directives in keepComments mode
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>11.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>jquante@web.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When running clang preprocessor with -C option (keep comments), preprocessor
directives that come after a comment are not resolved.

Example:

/* xxx */ #define X 1
int z=X;

clang -E -C keeps the entire code as it is, while clang -E correctly produces:
int z=1;

I would expect the following result:
/* xxx */
int z=1;

As far as I could debug this issue, it seems that pp. directives are only
recognized when the # is the first token on a line. Comments are not considered
for this (first token) criterion - a comment is a token in -C mode - but should
be ignored.

The same behavior occurs in clang 10 and 11.</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>