1. 17 Jun, 2014 1 commit
    • Wang Hoi's avatar
      C: Parser: Support parsing of c99 designated initializers · c56b999f
      Wang Hoi authored
      In case:
          int a[6] = { [4] = 29, [2] = 15 };
          struct point { int x, y; };
          struct point p = { .y = 3, .x = 2 };
      Grammar change when c99 language feature is enabled:
      old grammar:
          braced-init-list :: '{' initializer-list '}'
      new grammar:
          braced-init-list :: '{' designated-initializer-list '}'
          designated-initializer-list :: designated-initializer (',' designated-initializer )*
          designated-initializer :: designator* initializer-clause
          designator :: '.' identifier
                      | '[' constant-expression ']'
      Task-number: QTCREATORBUG-1902
      Change-Id: Ib99d6f553f8d0f50ba3eff86f3a2e86d73372426
      Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
  2. 23 May, 2014 1 commit
    • Nikolai Kosjar's avatar
      C++: Support for UTF-8 in the lexer · 70122b30
      Nikolai Kosjar authored
      This will save us toLatin1() conversations in CppTools (which already
      holds UTF-8 encoded QByteArrays) and thus loss of information (see
      QTCREATORBUG-7356). It also gives us support for non-latin1 identifiers.
      API-wise the following functions are added to Token. In follow-up
      patches these will become handy in combination with QStrings.
          utf16chars() - aequivalent of bytes()
          utf16charsBegin() - aequivalent of bytesBegin()
          utf16charsEnd() - aequivalent of bytesEnd()
      Next steps:
       * Adapt functions from TranslationUnit. They should work with utf16
         chars in order to calculate lines and columns correctly also for
         UTF-8 multi-byte code points.
       * Adapt the higher level clients:
          * Cpp{Tools,Editor} should expect UTF-8 encoded Literals.
          * Cpp{Tools,Editor}: When dealing with identifiers on the
            QString/QTextDocument layer, code points
            represendet by two QChars need to be respected, too.
       * Ensure Macro::offsets() and Document::MacroUse::{begin,end}() report
         offsets usable in CppEditor/CppTools.
      Addresses QTCREATORBUG-7356.
      Change-Id: I0791b5236be8215d24fb8e38a1f7cb0d279454c0
      Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
  3. 15 May, 2014 1 commit
  4. 05 Mar, 2014 1 commit
  5. 26 Nov, 2013 1 commit
  6. 15 Oct, 2013 1 commit
  7. 17 Sep, 2012 1 commit
  8. 23 Aug, 2012 1 commit
    • Leandro Melo's avatar
      C++: Introduce C++11 raw string literals · e148d030
      Leandro Melo authored
      Although they are now supported by the lexer
      and parser, it is worth to remind that we still
      need to address an issue concerning the highlight
      of multiline literals (which with the advent of
      the new raw strings will become more common).
      Task-number: QTCREATORBUG-6722
      Change-Id: I137337a9ac0152a1f8b9faded0b960c6fe3dd38a
      Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
  9. 28 Jun, 2012 1 commit
    • Leandro Melo's avatar
      C++: Parse emit/Q_EMIT properly · 621e5c3d
      Leandro Melo authored
      The parser now understands emit/Q_EMIT as an expression statement.
      Also, the recent fixes in the preprocessor introduced a side-effect
      in the hanlding of code such as: emit signal(); Member signal started
      being treated as a local use (parsed as a declaration) and possibily
      being highlighted as unused variable.
      Previously that worked by accident since there was an inconsistency
      in the preprocessor on which only object-like macros were being
      expanded even when the "no expand" flag was set. Then, the code
      mentioned above was being parsed as an expression, what kind of worked.
      Change-Id: I47a68ed4c1c1702872620b8ed7c7264fb0997034
      Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
  10. 25 Jun, 2012 1 commit
    • Leandro Melo's avatar
      C++: Core changes in preprocessing · d6ccffc0
      Leandro Melo authored
      Summary of most relevant items:
      - Preprocessor output format change. No more gen true/false. Instead
        a more intuitive and natural expansion (like from a real compiler) is
        performed directly corresponding to the macro invocation. Notice that
        information about the generated tokens is not lost, because it's now
        embedded in the expansion section header (in terms of lines and columns
        as explained in the code). In addition the location on where the macro
        expansion happens is also documented for future use.
      - Fix line control directives and associated token line numbers.
        This was not detected in tests cases because some of them were
        actually wrong: Within expansions the line information was being
        considered as originally computed in the macro definition, while
        the desired and expected for Creator's reporting mechanism (just
        like regular compilers) is the line from the expanded version
        of the tokens.
      - Do not allow for eager expansion. This was previously being done
        inside define directives. However, it's not allowed and might
        lead to incorrect results, since the argument substitution should
        only happen upon the macro invocation (and following nested ones).
        At least GCC and clang are consistent with that. See test case
        tst_Preprocessor:dont_eagerly_expand for a detailed explanation.
      - Revive the 'expanded' token flag. This is used to mark every token
        that originates from a macro expansion. Notice, however, that
        expanded tokens are not necessarily generated tokens (although
        every generated token is a expanded token). Expanded tokens that
        are not generated are those which are still considered by our
        code model features, since they are visible on the editor. The
        translation unit is smart enough to calculate line/column position
        for such tokens based on the information from the expansion section
      - How expansions are tracked has also changed. Now, we simply add
        two surrounding marker tokens to each "top-level" expansion
        sequence. There is an enumeration that control expansion states.
        Also, no "previous" token is kept around.
      - Preprocessor client methods suffered a change in signature so
        they now receive the line number of the action in question as
        a paramater. Previously such line could be retrieved by the client
        implementation by accessing the environment line. However, this
        is not reliable because we try to avoid synchronization of the
        output/environment lines in order to avoid unnecessary output,
        while expanding macros or handling preprocessor directives.
      - Although macros are not expanded during define directives (as
        mentioned above) the preprocessor client is now "notified"
        when it sees a macro. This is to allow usage tracking.
      - Other small stuff.
      This is all in one patch because the fixes are a consequence
      of the change in preprocessing control.
      Change-Id: I8f4c6e6366f37756ec65d0a93b79f72a3ac4ed50
      Reviewed-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
  11. 06 Jun, 2012 2 commits
    • Leandro Melo's avatar
      C++: Introduce unicode char/strings support · 23c637c4
      Leandro Melo authored
      Those are the types char16_t and char32_t along with the new
      char/string literals u'', U'', u"", u8"", and U"".
      This is particularly important for the use of QStringLiteral
      since in some platforms it relies on expansion such as above.
      Note: The string literals quickfixes still need some tunning.
      Task-number: QTCREATORBUG-7449
      Change-Id: Iebcfea15677dc8e0ebb6143def89a5477e1be7d4
      Reviewed-by: default avatarhjk <qthjk@ovi.com>
    • Leandro Melo's avatar
      C++: Add Token::isStringLiteral and Token::isCharLiteral · b88a5f5d
      Leandro Melo authored
      It will be particularly handy when introducing the new C++11
      string/char literals: U"abc", u"abc", u8"abc", U'a', u'a'.
      Change-Id: Ic250f5a7b999da322debb24fc0171aaef333f356
      Reviewed-by: default avatarhjk <qthjk@ovi.com>
  12. 18 Apr, 2012 1 commit
  13. 10 Feb, 2012 1 commit
  14. 02 Feb, 2012 2 commits
  15. 18 Nov, 2011 2 commits
  16. 16 May, 2011 2 commits
  17. 06 May, 2011 1 commit
  18. 13 Apr, 2011 1 commit
  19. 04 Feb, 2011 1 commit
  20. 12 Jan, 2011 2 commits
  21. 04 Jan, 2011 1 commit
  22. 17 Dec, 2010 1 commit
  23. 17 Mar, 2010 2 commits
  24. 05 Mar, 2010 1 commit
  25. 15 Feb, 2010 2 commits
  26. 08 Feb, 2010 1 commit
  27. 04 Feb, 2010 1 commit
  28. 19 Jan, 2010 1 commit
  29. 01 Dec, 2009 1 commit
  30. 30 Nov, 2009 1 commit
  31. 23 Nov, 2009 1 commit
  32. 13 Nov, 2009 1 commit
  33. 20 Oct, 2009 1 commit
    • Roberto Raggi's avatar
      Cleanup the C++ front-end. · 13675cf6
      Roberto Raggi authored
      Removed CPLUSPLUS_BEGIN/END_NAMESPACE & co and made it possible to compile the parser with CPLUSPLUS_WITHOUT_QT.