1. 29 Nov, 2013 2 commits
  2. 28 Nov, 2013 1 commit
  3. 10 Oct, 2013 1 commit
  4. 12 Sep, 2013 1 commit
  5. 17 Jul, 2013 1 commit
  6. 11 Jun, 2013 1 commit
    • Erik Verbruggen's avatar
      C++: Fix preprocessor blocked macro bug. · 271c3f45
      Erik Verbruggen authored
      By lexing the first token after a macro call (meaning: the token after
      the closing parenthesis (which was passed to handleFunctionLikeMacro
      which in turn pushed it back into the token buffer)), a token buffer
      might be popped, which unblocks the macro that generated the actual
      param pack. The effect was that if this happens in the expansion of a
      recursive macro (with parameters!), the preprocessor ended up in an
      infinite loop.
      Task-number: QTCREATORBUG-9015
      Task-number: QTCREATORBUG-9447
      Change-Id: I0d83c59188ec15c4a948970e9fa944a17d765475
      Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
  7. 03 Jun, 2013 1 commit
  8. 30 May, 2013 1 commit
    • Erik Verbruggen's avatar
      C++: do not strip trailing newlines in the preprocessor output. · f2631ad0
      Erik Verbruggen authored
      Doing so resulted in an incorrect position for the EOF token when the
      preprocessed output would be parsed. That in turn leads to incorrect
      insertion positions for refactoring actions.
      This is especially true when a file contains only preprocessor
      directives: the EOF token would point to line 1 column 1, which is
      usually not the place where code should be inserted.
      Change-Id: I7d359aa7a6c04bc52c8b873fd49ad6afc3a77319
      Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
  9. 29 Apr, 2013 1 commit
    • Francois Ferrand's avatar
      C++: fix handling of empty va_args macro arguments. · 4d18710f
      Francois Ferrand authored
      Preprocessor did not correctly handle when variadic macro arguments were not
      provided at all, if there were other arguments: macro was not expanded
      in case only the non variadic arguments were given.
       #define MACRO(...)       used to work fine for 0 or more arguments.
       #define MACRO(ARG0, ...) used to work only for 2 or more arguments, now fixed.
      Change-Id: I64e9199ceccae05618a49931c2adad8e4f9471ba
      Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
  10. 19 Apr, 2013 1 commit
  11. 16 Apr, 2013 2 commits
  12. 08 Apr, 2013 1 commit
    • Erik Verbruggen's avatar
      C++: pre-allocate the output buffer. · 2d500117
      Erik Verbruggen authored
      This prevents a whole lot of re-allocations when the output byte array
      needs to grow. It also prevents some heap fragmentation for big files.
      Because the preprocessed output is short lived (it will be parsed
      immediately after, and then discarded), it is not squeezed to the
      minimal size. This would result in another allocation.
      Change-Id: I4974be5144f88cdfc4ddc9d8330200725aa90803
      Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
      Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
  13. 03 Apr, 2013 1 commit
  14. 22 Feb, 2013 1 commit
  15. 29 Jan, 2013 1 commit
  16. 18 Jan, 2013 2 commits
    • Erik Verbruggen's avatar
      C++: add include-guard tracking. · dada2614
      Erik Verbruggen authored
      Track the typical #ifndef/#define/#endif usage in header files to see if
      the macro is an include guard. If so, store it in the Document. No
      behavioural change, just recording the name.
      This can be used in the future to track if a file needs to be re-parsed
      when a macro changes: if it was used in the file, and not defined in it
      nor being the include-guard, a file should be re-preprocessed and
      It can also be used to check if two files have the same include guard.
      Change-Id: I2715f529997a7b24a11bdbc6150652e2669f1a46
      Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
    • Francois Ferrand's avatar
      C++: fix macro calls with comment before arguments · 4c43655c
      Francois Ferrand authored
      When in 'keep comments' mode, the preprocessor does not properly handle macro calls with
      comments between the macro name and the opening parenthesis: "FOO /*something to say*/
      Change-Id: I6fe733242e4d2ccff2985d17399d0a084917415a
      Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
  17. 11 Jan, 2013 2 commits
  18. 08 Jan, 2013 1 commit
    • Orgad Shaneh's avatar
      Remove braces for single lines of conditions · 29a93998
      Orgad Shaneh authored
      #!/usr/bin/env ruby
      Dir.glob('**/*.cpp') { |file|
        # skip ast (excluding paste, astpath, and canv'ast'imer)
        next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
        s = File.read(file)
        next if s.include?('qlalr')
        orig = s.dup
        s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
          res = $&
          if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
            res.gsub!('} else', 'else')
            res.gsub!(/\n +} *\n/m, "\n")
            res.gsub(/ *{$/, '')
        s.gsub!(/ *$/, '')
        File.open(file, 'wb').write(s) if s != orig
      Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
      Reviewed-by: default avatarhjk <qthjk@ovi.com>
  19. 20 Dec, 2012 1 commit
  20. 04 Dec, 2012 1 commit
  21. 15 Oct, 2012 1 commit
  22. 05 Oct, 2012 1 commit
  23. 19 Sep, 2012 1 commit
  24. 11 Sep, 2012 1 commit
  25. 05 Sep, 2012 1 commit
  26. 29 Aug, 2012 1 commit
  27. 23 Aug, 2012 2 commits
  28. 07 Aug, 2012 2 commits
  29. 06 Aug, 2012 1 commit
  30. 19 Jul, 2012 1 commit
  31. 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>
  32. 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>
  33. 19 Jun, 2012 1 commit
    • Leandro Melo's avatar
      C++: Better handling of arg count mismatch in macros · f978400a
      Leandro Melo authored
      Do not expand function-like macros at all when there's a mismatch
      in the parameter/argument count.
      The report below raises the issue but its expected result is not
      correct. This would be the more appropriate fix.
      Task-number: QTCREATORBUG-7225
      Change-Id: Ide8580faa7b724d3e8b396ec1f899cc5ca7f9e7e
      Reviewed-by: default avatarhjk <qthjk@ovi.com>
  34. 12 Jun, 2012 1 commit