Review Request 114628: Improves declarator parsing.
Paweł Nowak
pn347193 at students.mimuw.edu.pl
Sun Dec 22 23:20:26 UTC 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/114628/
-----------------------------------------------------------
Review request for KDevelop.
Bugs: 280244
http://bugs.kde.org/show_bug.cgi?id=280244
Repository: kdevelop
Description
-------
This patch fixes incorrect parsing of declarations like "int (func)(int);" - where the declarator id is inside parentheses but it is not a function pointer, as well as some more issues. I have attached a file comparing old and new parsing results. It shouldn't affect anything that was already parsed successfully.
Additionally it eliminates some code duplication: now both parseDeclarator and parseAbstractDeclarator call parseDeclaratorInternal.
However, still a lot of old problems remain:
-function pointers are displayed as functions
-grouping in declarations like "int *(test[3])" is dropped so it becomes "int *test[3]"
-function types as template parameters are not handled correctly - "std::function<void(int)>" becomes "std::function<void>" somewhere in builders
and fixing them doesn't look that easy.
This is my first contribution to kdevelop and I hope I haven't broken anything :)
Diffs
-----
languages/cpp/cppduchain/contextbuilder.cpp 668aed1
languages/cpp/cppduchain/declarationbuilder.cpp b264858
languages/cpp/cppduchain/expressionvisitor.cpp d62f3e2
languages/cpp/parser/ast.h db20d74
languages/cpp/parser/codegenerator.cpp 2bc5f8e
languages/cpp/parser/default_visitor.cpp 9b43ae0
languages/cpp/parser/parser.h 933e2c8
languages/cpp/parser/parser.cpp c59bd78
Diff: https://git.reviewboard.kde.org/r/114628/diff/
Testing
-------
Current git head is pretty broken so I tested using commit 4ac7ec339a29ee419f08d9ff29ce544e8a710c7c.
All tests pass (except for qtprinters, what is unrelated to this patch).
File Attachments
----------------
Comparison between old and new declarator parsing
https://git.reviewboard.kde.org/media/uploaded/files/2013/12/22/6eceb9a7-458d-42b1-ae42-4f7368ecdc74__test2.cpp
Thanks,
Paweł Nowak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20131222/e171597a/attachment.html>
More information about the KDevelop-devel
mailing list