Skip to content
  • Milian Wolff's avatar
    c++11 support: initial support for initializer lists · 65db1f2a
    Milian Wolff authored
    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.:
    http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm or http://www.nongnu.org/hcb/#brace-or-equal-initializer 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...
    
    REVIEW: 102618
    65db1f2a