<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - The preprocessor returns incorrect ranges of macros with certain combinations of headers"
   href="https://llvm.org/bugs/show_bug.cgi?id=24655">24655</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>The preprocessor returns incorrect ranges of macros with certain combinations of headers
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>dpldobrev@yahoo.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14804" name="attach_14804" title="A test case">attachment 14804</a> <a href="attachment.cgi?id=14804&action=edit" title="A test case">[details]</a></span>
A test case

My name is Dimitar Dobrev and I develop a project that creates C# wrappers for
C++ code. We use Clang to parse C++ and we have this bug -
<a href="https://github.com/mono/CppSharp/issues/543">https://github.com/mono/CppSharp/issues/543</a> . In short, a function
(QAbstractSlider::wheelEvent) is reported as having macros above itself while
in fact it has none. You can see the headers involved at
<a href="http://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/accessible/complexwidgets.h">http://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/accessible/complexwidgets.h</a>
and
<a href="http://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/widgets/qabstractslider.h">http://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/widgets/qabstractslider.h</a>
.

The project leader, Joao Matos, and I have been working on it for more than a
week now and we think there may be a bug in
PreprocessingRecord::getPreprocessedEntitiesInRange. There is a comment in that
code where it is acknowledged that endings may not be ordered. However, we
believe that unlike what the comments states, that order is actually important.
Furthermore, we have discovered that replacing getEnd() with getBegin() in
findBeginLocalPreprocessedEntity eliminates our bug. This is, however, just a
workaround because Argyrios Kyrtzidis was kind enough to tell us the change
breaks some of your tests. We thought it made sense because you use binary
search which requires elements to be sorted, and the list is, evident from
PreprocessingRecord::addPreprocessedEntity, sorted by beginnings and therefore
- because of macro expansion - not necessarily by endings at the same time.

I have attached a test case generated by running Clang with -frewrite-includes.
Let me know if I can help further.</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>