[llvm-bugs] [Bug 24655] New: The preprocessor returns incorrect ranges of macros with certain combinations of headers
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Sep 1 10:13:56 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24655
Bug ID: 24655
Summary: The preprocessor returns incorrect ranges of macros
with certain combinations of headers
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: dpldobrev at yahoo.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 14804
--> https://llvm.org/bugs/attachment.cgi?id=14804&action=edit
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 -
https://github.com/mono/CppSharp/issues/543 . 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
http://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/accessible/complexwidgets.h
and
http://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/widgets/qabstractslider.h
.
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150901/9ba25308/attachment.html>
More information about the llvm-bugs
mailing list