Commit Graph

267 Commits

Author SHA1 Message Date
hjk
1490bab5bd CPlusPlus: Remove used Lexer::translationUnit() function
Change-Id: I81ec60c1d2b670b85bfeda25e6388a12c2cd0305
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-11-02 10:01:09 +00:00
Claus Steuer
158b07c9c8 C++: Support noexcept operator
The code model failed to parse the noexcept operator which is often
used in noexcept specifiers, e.g.: "void f() noexcept(noexcept(g()));"
Consequently some c++11 headers such as unordered_map, array
and unordered_set could not be parsed and no code completition was
available. I have created the NoExceptOperatorExpressionAST class
which is created whenever a noexcept token is found in an
expression with operator precedence. The noExcept test case
in the cplusplus/cxx11 test now contains a function that
uses the noexcept operator.

Fixed noexcept operator parsing

Added the test requested by Sergey Shambir, which then revealed that
i had not implemeneted the noexpect operator parsing according to the
c++ specification.
As stated here http://cpp0x.centaur.ath.cx/expr.unary.noexcept.html
the noexcept operator is a unary-expression that contains an
expression (and not a constant-expression). This should now be fixed.

Change-Id: Id4a99a43b660bd83e7680274491d99a698b57094
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-10-03 17:24:45 +00:00
Orgad Shaneh
0e8a0cac47 C++: Parse __alignof__
Change-Id: I093c2a786cf8f10de4f05c23f3763ef1300feabd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-10-02 14:55:00 +00:00
Nikolai Kosjar
d46e5025e5 C++: Highlight multi-line raw string literals
Task-number: QTCREATORBUG-13094
Change-Id: I4e6b8c202677f4c1cd4df95d59130ba8379e72fe
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-09-23 07:22:13 +00:00
Nikolai Kosjar
3edd1e575e C++: Mini refactorings in Lexer
...that will reduce noise in a follow-up change.

Change-Id: I39253fa631019c6d3177d2f8b2c521ec85bfba4b
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-09-23 07:22:06 +00:00
Thiago Macieira
25c6ea9ce7 Fix change-of-sign warning with ICC
src/libs/3rdparty/cplusplus/Lexer.cpp(88): warning #68: integer conversion resulted in a change of sign

Change-Id: I7de033f80b0e4431b7f1ffff13fa771758c95611
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-17 16:26:10 +00:00
Orgad Shaneh
ba9787a009 C++: Initialize memory after allocating symbol pointers
Change-Id: Ife1d3f963ef6781f96031f41ae3858b2c278145e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-04 09:58:32 +00:00
Orgad Shaneh
99dea548e0 C++: Fix crash in template argument resolving
Occurs in boost/phoenix.hpp

Task-number: QTCREATORBUG-14748
Change-Id: If89b0db48346aac72e0d8aaa8d165b2bf43bd784
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-03 09:31:45 +00:00
Nikolai Kosjar
9d5c85a635 C++: Limit parsing of initializer clauses II
This completes

    commit e69d20e10b
    C++: Limit parsing of initializer clauses

by handling the following code path:

    -------- parseExpressionStatement
    --------- parseExpression
    ---------- parseCastExpression
    ----------- parseUnaryExpression
    ------------ parsePostfixExpression
    ------------- parseCorePostfixExpression
    -------------- parsePrimaryExpression
    --------------- parseNumericLiteral
    ---------- parseExpressionWithOperatorPrecedence
    ----------- parseInitializerClause0x
    ------------ parseAssignmentExpression
    ------------- parseCastExpression
    -------------- parseUnaryExpression
    --------------- parsePostfixExpression
    ---------------- parseCorePostfixExpression
    ----------------- parsePrimaryExpression
    ------------------ parseNumericLiteral
    ------------- parseExpressionWithOperatorPrecedence
    ----------- parseInitializerClause0x
    ------------ parseAssignmentExpression
    ------------- parseCastExpression
    -------------- parseUnaryExpression
    --------------- parsePostfixExpression
    ---------------- parseCorePostfixExpression
    ----------------- parsePrimaryExpression
    ------------------ parseNumericLiteral
    ------------- parseExpressionWithOperatorPrecedence
    ----------- parseInitializerClause0x
    ...

Task-number: QTCREATORBUG-14645
Change-Id: I8a71fd687e15a3a4ae26e7b9830276464e3fa76e
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-07-06 12:11:43 +00:00
Nikolai Kosjar
17a4e76c50 C++: Use MAX_EXPRESSION_DEPTH and increase to 1000
We do not want different depths for different ASTs.

Change-Id: Idc4aff226b20dbc5c14a77ef729b16044b55b837
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-07-06 12:11:25 +00:00
Nikolai Kosjar
c9588aa877 C++: Add missing DEBUG_THIS_RULE() for Parser::parse*
Change-Id: Ic4d3ccd72618c512567140ea5af39ca0799cde3a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-07-06 09:25:23 +00:00
Nikolai Kosjar
f413330ada C++: Remove pointless declarations
Change-Id: I78ac11e081fc1136d41459e8408f8788276a454e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-07-06 09:25:19 +00:00
Orgad Shaneh
a77e32800c C++: Ignore explicit template instantiations
Defined in section 14.7.2 of the standard.

Fixes completion for std::string.

The following explicit instantiation appears in bits/basic_string.tcc:
  extern template class basic_string<char>;

This is wrongfully considered a specialization for a forward declaration
(like `template<> class basic_string<char>` is).

Introduce a new Symbol type for explicit instantiations.

Use-case:
template<class T>
struct Foo { T bar; };

template class Foo<int>;

void func()
{
    Foo<int> foo;
    foo.bar; // bar not highlighted
}

Change-Id: I9e35c8c32f6b78fc87b4f4f1fc903b42cfbd2c2b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-06-29 09:22:08 +00:00
Orgad Shaneh
a968940494 C++: Simplify Bind::asStringLiteral
Pass the expression directly

Change-Id: I44421fad0a0251641608d266fe681c05b3631064
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
2015-06-11 07:43:29 +00:00
Daniel Teske
26059dbb1e Make every operator bool() explicit
operator bool() is a trap, but with explicit it's far safer,
and we can use that now.

Change-Id: I4e58631c94e87c00256c3ab3cff4fd2c5f632713
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-06-02 16:06:22 +00:00
Johannes Lorenz
2a966a8917 C++: Support ellipsis on variadic inheritance parsing
Change-Id: I571aefdb1f2aba88ba0c7710f16b6d8ad2e8f5a8
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-06-02 08:24:17 +00:00
Eike Ziller
3858c33d74 Merge remote-tracking branch 'origin/3.4'
Change-Id: I35ba4cc7f7052699c3006545514c866be3cb5fdd
2015-05-26 15:12:42 +02:00
Orgad Shaneh
b5f6a9e6e5 C++: Fix decltype resolving for nested instantiated class
The enclosingScope of a cloned nested class is not the
original class but the cloned parent.

Use-case:
template <typename T>
struct Temp
{
    struct Nested
    {
        static T f();
        typedef decltype(f()) type;
    };
};

struct Foo { int bar; };

void fun()
{
    Temp<Foo>::Nested::type s;
    s.bar; // bar not highlighted
}

Task-number: QTCREATORBUG-14483
Change-Id: I3e15399a78a7492f740db8d0c7d5c84adf77d1d0
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-05-22 08:40:11 +00:00
Orgad Shaneh
04c4043e13 C++: Minor optimization
Avoid double map lookup

Change-Id: I5fe6b4a13829275f5a68f794cb820b488f4a5c8c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-05-22 08:08:04 +00:00
Orgad Shaneh
de68ac5407 C++: fix code completion for decltyped type
example:
struct Foo { int bar; };
Foo foo() { return Foo; }
typedef decltype(foo()) TypedefedFooWithDecltype;
void fun()
{
  decltype(foo()) decltypeFoo;
  decltypeFoo.;// code completion should work here

  TypedefedFooWithDecltype typedefedFooWithDecltype;
  typedefedFooWithDecltype.;// code completion should work here
}

Started-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Task-number: QTCREATORBUG-14483
Change-Id: I296ceed9d896c68cf0651265afb08a1fc42f9a68
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-05-20 10:45:31 +00:00
Nikolai Kosjar
e69d20e10b C++: Limit parsing of initializer clauses
...to prevent out of memory crash for generated tables.

Change-Id: I8f9f51829fcce5bccfe0dba8852023f8dd7d6e37
Task-number: QTCREATORBUG-14390
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-05-13 08:26:07 +00:00
hjk
50a685f8d8 CPlusPlus: Inline SymbolVisitor functions
Change-Id: I46221428f2c883103839e57c8fc433f05302addd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-04-22 11:16:10 +00:00
Orgad Shaneh
cb350bfeb2 C++: Rename ClassOrNamespace -> LookupScope
Change-Id: Ide74482b133dd1fec40a725d9aa81bd749385f37
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-04-20 14:51:56 +00:00
Francois Ferrand
1336502f58 C++: fix parsing nested C99 designated initializers.
Change-Id: Iaa0e7550abf6be77601b1852652bb3d0731d0323
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-02-27 14:49:55 +00:00
Orgad Shaneh
b30e807fac C++: Fix crash on static template instantiation
template<typename T>
struct QList
{
   struct iterator
   {
      T *operator->() { return &t; }
      T t;
   };
   static iterator begin() { return iterator(); }
};

struct Foo { int bar; };

void fun() {
   auto a = QList<Foo>::begin();
   a. // crash
}

Change-Id: I373c493b2eefc9566ec13165285c33d474a3b440
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-02-26 10:09:42 +00:00
Przemyslaw Gorszkowski
9e513774b1 C++: resolved self-value reference for enum
Added support for resolving case:
enum E
{
  val1,
  val2 = val1, // val2-4 are not resolved
  val3,
  val4
};

Task-number: QTCREATORBUG-13932
Change-Id: I122c5eb0b0397d6c02bc3db0a5c1ea1c28c5c6e7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-02-25 15:01:02 +00:00
Orgad Shaneh
fb758183d7 C++: Disable "signals" when qt keywords are disabled
Change-Id: Ib2334703247a4003015c7063730e0343054d3543
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-02-25 12:44:27 +00:00
Orgad Shaneh
f3a2795c3b C++: Use correct features for document parsing
Task-number: QTCREATORBUG-8007
Change-Id: Ic96aaa433442812a99bac9d16bb9124d66762e8c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-02-20 12:54:49 +00:00
Nikolai Kosjar
9fb5b0be15 CppTools: Add basic completion support for qt5 style signals/slots
Trigger completion for Qt5 signals/slots as soon as the user types '&'
in

    connect(object, &
    connect(object, &Foo:signal, object2, &

Change-Id: I338a26415196959e3dc413bdfd023314812f3aaa
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-02-17 13:47:38 +00:00
Adam Strzelecki
425811291d C++: Basic support for C++11 user-defined literals
1. Extends lexer so digit or string can be followed by underscore '_' and
   alphanumeric defining literal.

2. Extends parser so it accepts operator"" _abc(...) user-defined literal
   definition.

3. Adds Token::Flags.userDefinedLiteral bool flag field representing if token
   carries user-defined literal.

4. Adds C++11 auto tests case with: 12_km, 0.5_Pa, 'c'_X, "abd"_L, u"xyz"_M

5. All optional suffix scanning methods now return boolean if the suffix was
   found.

6. Adds C++ Lexer tests for user-defined literals with C++11 feature enabled.

This change however does not make QtCreator understand user-defined literal
semantics, e.g. properly resolve type when applying custom literal operator.

Change-Id: I30e62f025ec9fb11c39261985ea4d772b1a80949
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-02-17 09:45:34 +00:00
Eike Ziller
9926fc2ab1 Merge commit '3c85058694ee2e41658d17f524fb48f0b187d2fe'
Conflicts:
	src/libs/utils/tooltip/tipcontents.cpp
	src/libs/utils/tooltip/tipcontents.h
	src/plugins/android/androiddeployqtstep.cpp
	src/plugins/baremetal/baremetalconstants.h
	src/plugins/baremetal/baremetaldevice.cpp
	src/plugins/baremetal/baremetaldevice.h
	src/plugins/baremetal/baremetaldeviceconfigurationwidget.cpp
	src/plugins/baremetal/baremetaldeviceconfigurationwidget.h
	src/plugins/baremetal/baremetaldeviceconfigurationwizard.cpp
	src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.cpp
	src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.h
	src/plugins/baremetal/baremetalplugin.cpp
	src/plugins/baremetal/baremetalplugin.h
	src/plugins/baremetal/baremetalruncontrolfactory.cpp
	src/plugins/baremetal/baremetalruncontrolfactory.h
	src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
	src/plugins/cppeditor/cppdoxygen_test.cpp
	src/plugins/cppeditor/cppdoxygen_test.h
	src/plugins/debugger/breakpointmarker.cpp
	src/plugins/debugger/debuggeritemmodel.cpp
	src/plugins/debugger/debuggeritemmodel.h
	src/plugins/debugger/loadcoredialog.cpp
	src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp
	src/plugins/projectexplorer/addnewmodel.cpp
	src/plugins/projectexplorer/addnewmodel.h
	src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
	src/plugins/qmlprofiler/abstracttimelinemodel.cpp
	src/plugins/qmlprofiler/abstracttimelinemodel.h
	src/plugins/qmlprofiler/notesmodel.cpp
	src/plugins/qmlprofiler/qml/CategoryLabel.qml
	src/plugins/qmlprofiler/qml/MainView.qml
	src/plugins/qmlprofiler/qml/Overview.js
	src/plugins/qmlprofiler/qml/Overview.qml
	src/plugins/qmlprofiler/qml/TimeDisplay.qml
	src/plugins/qmlprofiler/qml/TimeMarks.qml
	src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
	src/plugins/qmlprofiler/sortedtimelinemodel.cpp
	src/plugins/qmlprofiler/sortedtimelinemodel.h
	src/plugins/qmlprofiler/timelinemodelaggregator.cpp
	src/plugins/qmlprofiler/timelinemodelaggregator.h
	src/plugins/qmlprofiler/timelinerenderer.cpp
	src/plugins/qmlprofiler/timelinerenderer.h
	src/plugins/qmlprojectmanager/QmlProjectManager.json.in
	src/plugins/texteditor/findinfiles.cpp
	src/plugins/vcsbase/vcsconfigurationpage.cpp
	src/shared/qbs
	src/shared/scriptwrapper/interface_wrap_helpers.h
	src/shared/scriptwrapper/wrap_helpers.h
	tests/auto/qmlprofiler/abstracttimelinemodel/tst_abstracttimelinemodel.cpp
	tests/system/suite_debugger/tst_debug_empty_main/test.py
	tests/system/suite_debugger/tst_qml_js_console/test.py
	tests/system/suite_debugger/tst_qml_locals/test.py

Change-Id: I67540b648f8b162496f4aa606b04d50c7c9125c6
2015-02-12 17:29:21 +01:00
Nikolai Kosjar
921ec6da5a C++: Cache parsing of template ids
...in order to stop memory intensive parsing for invalid code.

Parsing the test data/snippet "hard" led to a memory consumption of
about 5.5MB and this could easily get up to hundreds/gigabytes by adding
some more "if_<bool_<true>,\n" lines. With the caching, we are at about
1.0MB, even if more lines are added.

The "memory consumption" was measured with valgrind-massif. The stated
numbers are the reported peaks.

Task-number: QTCREATORBUG-12890
Change-Id: Ie7eb00cfc7915552d29bb27410a6b13a486f486e
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-02-12 10:40:14 +00:00
Nikolai Kosjar
ae3aa07c4d C++: Remove workaround for crashing if parsing invalid code
This reverts the changes

    commit beac7b9539
    C++: Fix highlighting after "invalid code"

    commit 78ab287fc6
    C++: Stop parsing a declaration after two tries

which were a work around for QTCREATORBUG-12890.

A follow-up patch provides a proper fix.

Task-number: QTCREATORBUG-12890
Change-Id: I2650a8e41c8ff1180cad9f069e463fc51bd2f1b1
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-02-12 10:39:51 +00:00
Nikolai Kosjar
9762afba60 C++: Remove unused RecursiveMemoryPool
Change-Id: I7009df49f79d8f895c5344f7be3558f7f3d35143
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-02-09 11:20:35 +00:00
Nikolai Kosjar
d4dcef2fc1 C++: Remove unused FullySpecifiedType::copySpecifiers()
Change-Id: I1ea33f71a1b00cac06336bd0205e81b62d4d4b49
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-02-09 11:20:14 +00:00
Orgad Shaneh
65e7db42b8 C++: Remove unneeded qualifications
Mostly done using the following ruby script:
Dir.glob('**/*.cpp').each { |file|
  next if file =~ %r{src/shared/qbs|/qmljs/}
  s = File.read(file)
  s.scan(/^using namespace (.*);$/) {
    ns = $1
    t = s.gsub(/^(.*)\b#{ns}::((?!Const)[A-Z])/) { |m|
      before = $1
      char = $2
      if before =~ /"|\/\/|\\|using|SIGNAL|SLOT|Q_/
        m
      else
        before + char
      end
    }
    if t != s
      puts file
      File.open(file, 'w').write(t)
    end
  }
}

Change-Id: I6fbe13ddc1485efe95c3156097bf41d90c0febac
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-02-04 15:27:22 +00:00
Przemyslaw Gorszkowski
955e28f954 C++: fix auto declaration in if condition
Fix for auto completion in case of auto declaration inside if condition:

struct Foo { int bar; };
void func()
{
    if (auto s = new Foo)
        s->; // auto completion does not work
}

Task-number: QTCREATORBUG-13805
Change-Id: Ia1776e8cc04e6040a6bf5f43cf82cfd6ce6dde7a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-02-04 11:55:04 +00:00
Orgad Shaneh
8bb176d2ec C++: Do not compare flags when matching types
Trust the matcher to do the job.

Task-number: QTCREATORBUG-13564
Change-Id: I4ff14608a1ce12d3f4424242e50ba71233ac9bfd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-01-21 12:05:32 +01:00
Eike Ziller
3c85058694 Update License
Change-Id: I711d5fb475ef814a1dc9d2822740e827f3f67125
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
2015-01-16 12:37:56 +01:00
Christian Stenger
d593a276b1 C++: Fix compile for MSVC2010
Change-Id: I3049efa29b80fecc6c9daa9e1eb967428d331bb2
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-01-14 14:09:57 +01:00
Nikolai Kosjar
845cb2e432 C++: Better names for Scope's iterators
Scope::lastMember() was misleading.

Change-Id: I953d489b8a2a9b86321f73cad3b7b371c4acf91f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
2015-01-14 12:29:37 +01:00
Nikolai Kosjar
8f988a0a21 C++: Compile fix for MSVC
Change-Id: Ie6399ae95b1dee84dc85fe2e7634c020b312a9a7
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
2015-01-14 12:01:06 +01:00
Przemyslaw Gorszkowski
9e159d87a8 C++: display enum value in tooltip for simplest case
If it is possible lets calculate enum value for the simplest case.
Example where it works:
enum
{
  enum_val1, // tooltip = "enum_val1 = 0"
  enum_val2 // tooltip = "enum_val2 = 1"
};

enum
{
  enum_val1=10, // tooltip = "enum_val1 = 10"
  enum_val2 // tooltip = "enum_val2 = 11"
};

enum
{
  enum_val1, // tooltip = "enum_val1 = 0"
  enum_val2=10, // tooltip = "enum_val2 = 10"
  enum_val3 // tooltip = "enum_val3 = 11"
};

Example where it does not work:
enum
{
  enum_val1=10+1, // tooltip = "enum_val1 = 10+1"
  enum_val2 // tooltip = "enum_val2"
};

Task-number: QTCREATORBUG-4529
Change-Id: Idd85ed7304018f73f2b068bf1ac28f1abde02f93
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-01-14 08:10:58 +01:00
Eike Ziller
b5b47f7df2 Merge remote-tracking branch 'origin/3.3'
Conflicts:
	src/plugins/cppeditor/cppdocumentationcommenthelper.cpp

Change-Id: I2cf25eba1de149765a6c44ad354d606ce9de512d
2015-01-08 10:38:20 +01:00
Aki Koskinen
7661ba74ed Prevent using an invalidated reference
Inserting to a std::vector (possibly) invalidates all iterators and
references for it.

In this piece of code tok is a reference to a member in _tokens and it
should not be used after an insertion is made to _tokens. Switched the
order of two code lines to prevent this.

Change-Id: Ia9d1ce66fc67406f56b426e7431402c6fe68a38f
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-01-07 12:05:50 +01:00
Erik Verbruggen
242b3f4110 C++: clean up numeric literal parsing and add support for n3472.
Separate the messy pp-number parsing from the numeric literal parsing.
The C/C++ preprocessor makes a grown man cry, but at least we have
"proper" literal parsing when we want it, including C++1y binary
literals.

Next step is digit separators (n3781).

Change-Id: Ia069eef454ed5c056f77694a5b8a595d0b76adc4
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-12-18 15:46:22 +01:00
Nikolai Kosjar
beac7b9539 C++: Fix highlighting after "invalid code"
For the semantic info document we do not expand function like macros and
because of that certain macro invocations lead to invalid code that we
need to handle, e.g.:

	Q_GLOBAL_STATIC(CppTools::SymbolFinder, symbolFinder)
	class Foo {};

This change makes parsing Foo in the semantic info document successfully
again, which affects highlighting of that class.

Change-Id: I389265ac64d3f0b8b8f406d38fa58d78820b14ba
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-11-19 16:10:56 +01:00
Nikolai Kosjar
78ab287fc6 C++: Stop parsing a declaration after two tries
If we fail to parse a declaration, we rewind, eat the token and look for the
next token that might be a good candidate for a declaration start (e.g. an
identifier). This becomes cpu and memory expensive with super long and invalid
expressions like

    typedef b:Ⓜ️:if_< b:Ⓜ️:bool_<
	(sizeof(fun((Dummy *) 0, (ThisT *) 0, (b:Ⓜ️:int_<70> *) 0)) ==
	 sizeof(defined_)) >, b:Ⓜ️:if_< b:Ⓜ️:bool_<
	(sizeof(fun((Dummy *) 0, (ThisT *) 0, (b:Ⓜ️:int_<71> *) 0)) ==
	 sizeof(defined_)) >, b:Ⓜ️:if_< b:Ⓜ️:bool_<
	(sizeof(fun((Dummy *) 0, (ThisT *) 0, (b:Ⓜ️:int_<72> *) 0)) ==
	 sizeof(defined_)) >, b:Ⓜ️:if_< b:Ⓜ️:bool_<
	(sizeof(fun((Dummy *) 0, (ThisT *) 0, (b:Ⓜ️:int_<73> *) 0)) ==
	 sizeof(defined_)) >, b:Ⓜ️:if_< b:Ⓜ️:bool_<
	(sizeof(fun((Dummy *) 0, (ThisT *) 0, (b:Ⓜ️:int_<74> *) 0)) ==
	 sizeof(defined_)) >, b:Ⓜ️:if_< b:Ⓜ️:bool_<
	(sizeof(fun((Dummy *) 0, (ThisT *) 0, (b:Ⓜ️:int_<75> *) 0)) ==
	 sizeof(defined_)) >, b:Ⓜ️:if_< b:Ⓜ️:bool_<
	// ...some more crazy lines like this

Therefore, stop trying after two failures by looking for the next semicolon or
closing curly brace.

Task-number: QTCREATORBUG-12890
Change-Id: I6637daeb840dd549d669080775228fa91fc932eb
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-11-18 13:46:34 +01:00
Orgad Shaneh
541762a1a1 C++: Remove unused file
Change-Id: I5e4f03f9a5f80b2697ac1e7a952a8c5b5765aae2
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2014-11-04 08:37:06 +01:00
hjk
601ce9baa5 CPlusPlus: Inline some Literals members
Basically all that generate at most 7 bytes. With the call being 5
and some hope of intra-caller optimization gains that shouldn't explode.

Change-Id: I4145d69d38a7956362263e9d432eb47bb58d3261
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2014-10-21 09:42:27 +02:00