initial support for C++11 initializer lists

Review Request #102618 - Created Sept. 15, 2011 and submitted

Milian Wolff
This is the first step towards support of initializer lists as per the C++2011 spec in KDevelop. See the new spec or e.g.: or for details.

Notes on this patch: It's ugly as hell. And it's so ugly because parts of our parser are hideous. Most importantly there currently is no notion at all of member-declaration/declarator at all. The beast that is parseDeclarationInternal is very fragile... I did not want to rewrite the whole parser and rip out parseDeclarationInternal yet. But I think we definitely should do this in the future and follow the spec as much as possible, as it makes the code much better to understand and extend.

Furthermore it is just the very basics, i.e. stuff like 'int i = {1};' that works now. I'll work on the other uses of the init list once this is in and noone complained about regressions.

For now: I had to change the order of "look for simple declaration" vs "look for function definition", as otherwise function definitions followed by an empty declaration (";") would be seen as a simple declaration with init list...

I've also found a bug in test_generator where a "()" was missing but apparrently noone ever noticed ;-) This is now done properly though.

General hints on how to achieve this in a cleaner way would be *much* appreciated. But I think the only really clean solution is to rewrite the parser and follow the spec. This patch took me more than a month to get into this shape...
All unit tests pass or XFAIL as before.

I'll now begin testing it inside kdevelop on actual live code, would be cool if you guys could do the same.
Commit Hook
This review has been submitted with commit 65db1f2a7787c7278ce75a33fd6e458741d12696 by Milian Wolff to branch master.
Milian Wolff
Review request changed

Status: Closed (submitted)