Commit Graph

230 Commits

Author SHA1 Message Date
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
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
Nikolai Kosjar
390b4f0e0b C++: Fix parsing of "Foo *foo = new Foo()"
It should be parsed as an DeclarationStatement, but instead it was
parsed as an ExpressionStatement.

Regression introduced with

    commit d3c5fff66d.
    C++: Fix expensive parsing of expressions

The introduced ASTCache did not save the correct return value of a
parse* function. Because of that, the first return in
Parser::parseExpressionList returned false on the second invocation
(cache hit), instead of true, which resulted in an ExpressionStatement.

Task-number: QTCREATORBUG-13122
Change-Id: I8dbd8852b0909edddcd3195b484f4cea92328cc5
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
2014-10-15 10:08:19 +02:00
Eike Ziller
ea27143239 Merge remote-tracking branch 'origin/3.2'
Conflicts:
	src/libs/utils/ipaddresslineedit.cpp
	src/libs/utils/logging.h
	src/plugins/analyzerbase/AnalyzerBase.pluginspec.in
	src/plugins/android/Android.pluginspec.in
	src/plugins/android/androiddeploystep.cpp
	src/plugins/android/androiddeploystep.h
	src/plugins/android/androiddeploystepfactory.cpp
	src/plugins/android/androiddeploystepwidget.cpp
	src/plugins/android/androidpackagecreationfactory.cpp
	src/plugins/android/androidpackagecreationstep.cpp
	src/plugins/android/androidpackagecreationstep.h
	src/plugins/android/androidpackagecreationwidget.cpp
	src/plugins/android/androidpackagecreationwidget.h
	src/plugins/android/javafilewizard.cpp
	src/plugins/autotoolsprojectmanager/AutotoolsProjectManager.pluginspec.in
	src/plugins/baremetal/BareMetal.pluginspec.in
	src/plugins/bazaar/Bazaar.pluginspec.in
	src/plugins/beautifier/Beautifier.pluginspec.in
	src/plugins/bineditor/BinEditor.pluginspec.in
	src/plugins/bookmarks/Bookmarks.pluginspec.in
	src/plugins/clangcodemodel/ClangCodeModel.pluginspec.in
	src/plugins/clangcodemodel/clanghighlightingsupport.cpp
	src/plugins/clangcodemodel/clangsymbolsearcher.cpp
	src/plugins/classview/ClassView.pluginspec.in
	src/plugins/clearcase/ClearCase.pluginspec.in
	src/plugins/cmakeprojectmanager/CMakeProjectManager.pluginspec.in
	src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp
	src/plugins/cmakeprojectmanager/cmakehighlighter.cpp
	src/plugins/coreplugin/Core.pluginspec.in
	src/plugins/cpaster/CodePaster.pluginspec.in
	src/plugins/cppeditor/CppEditor.pluginspec.in
	src/plugins/cppeditor/cppfilewizard.cpp
	src/plugins/cpptools/CppTools.pluginspec.in
	src/plugins/cpptools/cpphighlightingsupportinternal.cpp
	src/plugins/cpptools/cppmodelmanagerinterface.cpp
	src/plugins/cpptools/cppmodelmanagerinterface.h
	src/plugins/cvs/CVS.pluginspec.in
	src/plugins/debugger/Debugger.pluginspec.in
	src/plugins/designer/Designer.pluginspec.in
	src/plugins/diffeditor/DiffEditor.pluginspec.in
	src/plugins/emacskeys/EmacsKeys.pluginspec.in
	src/plugins/fakevim/FakeVim.pluginspec.in
	src/plugins/genericprojectmanager/GenericProjectManager.pluginspec.in
	src/plugins/git/Git.pluginspec.in
	src/plugins/git/gitorious/gitorious.cpp
	src/plugins/git/gitorious/gitorious.h
	src/plugins/git/gitorious/gitoriousclonewizard.cpp
	src/plugins/git/gitorious/gitorioushostwidget.cpp
	src/plugins/git/gitorious/gitorioushostwidget.h
	src/plugins/git/gitorious/gitorioushostwizardpage.cpp
	src/plugins/git/gitorious/gitoriousprojectwidget.cpp
	src/plugins/git/gitorious/gitoriousprojectwidget.h
	src/plugins/git/gitorious/gitoriousprojectwizardpage.cpp
	src/plugins/git/gitorious/gitoriousprojectwizardpage.h
	src/plugins/git/gitorious/gitoriousrepositorywizardpage.cpp
	src/plugins/git/gitorious/gitoriousrepositorywizardpage.h
	src/plugins/glsleditor/GLSLEditor.pluginspec.in
	src/plugins/glsleditor/glsleditorfactory.cpp
	src/plugins/glsleditor/glslfilewizard.cpp
	src/plugins/helloworld/HelloWorld.pluginspec.in
	src/plugins/help/Help.pluginspec.in
	src/plugins/imageviewer/ImageViewer.pluginspec.in
	src/plugins/ios/Ios.pluginspec.in
	src/plugins/macros/Macros.pluginspec.in
	src/plugins/mercurial/Mercurial.pluginspec.in
	src/plugins/perforce/Perforce.pluginspec.in
	src/plugins/projectexplorer/ProjectExplorer.pluginspec.in
	src/plugins/pythoneditor/PythonEditor.pluginspec.in
	src/plugins/pythoneditor/pythoneditorwidget.cpp
	src/plugins/pythoneditor/wizard/pythonfilewizard.cpp
	src/plugins/qbsprojectmanager/QbsProjectManager.pluginspec.in
	src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp
	src/plugins/qmakeprojectmanager/QmakeProjectManager.pluginspec.in
	src/plugins/qmakeprojectmanager/profileeditorfactory.cpp
	src/plugins/qmldesigner/QmlDesigner.pluginspec.in
	src/plugins/qmljseditor/QmlJSEditor.pluginspec.in
	src/plugins/qmljseditor/qmljseditorfactory.cpp
	src/plugins/qmljstools/QmlJSTools.pluginspec.in
	src/plugins/qmlprofiler/QmlProfiler.pluginspec.in
	src/plugins/qmlprojectmanager/QmlProjectManager.pluginspec.in
	src/plugins/qnx/Qnx.pluginspec.in
	src/plugins/qtsupport/QtSupport.pluginspec.in
	src/plugins/remotelinux/RemoteLinux.pluginspec.in
	src/plugins/resourceeditor/ResourceEditor.pluginspec.in
	src/plugins/resourceeditor/resourcewizard.h
	src/plugins/subversion/Subversion.pluginspec.in
	src/plugins/tasklist/TaskList.pluginspec.in
	src/plugins/texteditor/TextEditor.pluginspec.in
	src/plugins/texteditor/basetexteditor_p.h
	src/plugins/texteditor/basetextmark.cpp
	src/plugins/texteditor/codeassist/basicproposalitemlistmodel.h
	src/plugins/texteditor/codeassist/defaultassistinterface.h
	src/plugins/texteditor/codeassist/iassistproposalitem.cpp
	src/plugins/texteditor/itexteditor.cpp
	src/plugins/texteditor/itexteditor.h
	src/plugins/texteditor/itextmark.cpp
	src/plugins/texteditor/plaintexteditor.cpp
	src/plugins/texteditor/plaintexteditor.h
	src/plugins/texteditor/texteditoractionhandler.cpp
	src/plugins/todo/Todo.pluginspec.in
	src/plugins/updateinfo/UpdateInfo.pluginspec.in
	src/plugins/valgrind/Valgrind.pluginspec.in
	src/plugins/vcsbase/VcsBase.pluginspec.in
	src/plugins/welcome/Welcome.pluginspec.in
	src/plugins/winrt/WinRt.pluginspec.in
	tests/auto/debugger/temporarydir.h

Change-Id: I254af8be8119fe9855287909e17d4b8ca9d2fc2f
2014-10-14 15:36:16 +02:00
Eike Ziller
8295b503be License update
Change-Id: I3c22ef2685d7aa589f5d0ab74d693653a4c32082
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
2014-10-09 11:41:44 +02:00
Erik Verbruggen
4cfb7a62b7 C++: remove dead store.
Pointed out by the clang static analyzer.

Change-Id: I2d73d4c9ef2511c5697a4e4da89b61efb1149a3f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-09-12 11:31:51 +02:00
Erik Verbruggen
ebcd4ce8db C++: fix possible nullptr deref.
Pointed out by the clang static analyzer.

Change-Id: I69ab89e651cbcb13606d5d93a05f629172cbd9e0
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-09-12 11:31:46 +02:00
Erik Verbruggen
42038ca35a C++: remove reserved names and regenerate some files.
See [global.names] (17.6.4.3.2 in the C++11 spec.)

Change-Id: If6905bbac3a7464aeb5a49227e0f6b5c91d6033b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-08-28 18:03:40 +02:00
Erik Verbruggen
703f36a4b8 C++: remove reserved names.
See [global.names] (17.6.4.3.2 in the C++11 spec.)

Change-Id: I8434496dbe392b52d339d5f17cfaeee8dbd88995
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-08-28 17:58:33 +02:00
Erik Verbruggen
271c1bb89a C++: change return type to enum.
And not have it converted to int after converting to unsigned.

Change-Id: If95caec46936c2a140c3fbd668fa2f085a9287ed
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-08-20 14:08:48 +02:00
Oswald Buddenhagen
f3a61e8bf7 Merge remote-tracking branch 'origin/3.2'
Conflicts:
	qtcreator.pri
	qtcreator.qbs
	src/plugins/android/androidglobal.h

Change-Id: I3367bf2ea47c088989175dddeed2210294346f4c
2014-08-05 14:24:23 +02:00
Tobias Hunger
c4eb09e9fb CppCheck: Fix fprintf format code to match unsigned type
Change-Id: Id4527ab5582294791b8db0c7ce9240e031a38bd7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-08-05 10:52:17 +02:00
Tobias Hunger
6d3367c46e CppCheck: Initialize some variables in the constructor
Change-Id: Ife4c078d1e77409f04be32220ac2b18d006e26d0
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-08-05 10:52:12 +02:00
Tobias Hunger
6bd1ab0cdc CppCheck: Fix possible null pointer access
The variable is checked for 0 elsewhere in this method, so it probably
makes sense to check it here as well.

Change-Id: Idb869dda54ed340e1b2f03c7d4c06f2a93c00887
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-08-05 10:52:05 +02:00
Nikolai Kosjar
d3c5fff66d C++: Fix expensive parsing of expressions
For expression statements like "(g(g(g(...(g(0))...))))" we reparsed
quite much again and again for nothing. The high-level trace for this
expression looks like this:

    parseCastExpression
      parseTypeId
        parseAbstractDeclarator
          parseAbstractCoreDeclarator
          parseParameterDeclarationClause (--> DEEP)
            ...

      parseUnaryExpression
        ...
        parseCorePostfixExpression
          parseTypeId (--> DEEP)
          parsePrimaryExpression (--> DEEP)

Especially parseTypeId is expensive in this case and it's called two
times, both from the same token (index).

With this patch, we remember for certain ASTs the parse results and
re-use them when needed.

Change-Id: I013d1c064c655636bc94db408097863b5e183fc2
Task-number: QTCREATORBUG-12252
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-07-24 12:06:50 +02:00
Nikolai Kosjar
20108a3d88 C++: Remove superfluous declarations in Parser
Change-Id: I6bf729a999494a84eb235a891ea14bbccd44aeb8
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-07-24 12:06:17 +02:00
Erik Verbruggen
3a242495fe ObjC++: also index ObjC symbols.
@classes, @protocols, @properties and -methods (and +methods) will now
show up in the locator.

Change-Id: I33f904c456c321fc80b8aba7ff52d5f1207c58be
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-07-24 11:38:54 +02:00
Erik Verbruggen
45b1169d06 C++: Support alignas in C++11 mode.
Change-Id: Ifa81a481bf92b5b71495a105ae292f3e9895f704
Task-number: QTCREATORBUG-9279
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-07-22 16:43:51 +02:00
Eike Ziller
0374a9782e Merge remote-tracking branch 'origin/3.2' into HEAD
Change-Id: I257bb9310bb3bde493aff4cd43091ec63fcb5203
2014-07-22 16:11:40 +02:00
Erik Verbruggen
5d45e0b69a C++: block recursion when parsing subsequent case statements.
A case or a default statement must be followed by another statement.
When a such a case (or default) statement is followed immediately by
another case (or default) statement, then this would create a linked
list, and the parser will recurse to parse such input.

In order to prevent the parser running out of stack space while
recursing, parse this corner case by blocking parsing a labeled
statement as the first statement after a labeled statement.

The advantage is that these statements do not form a linked list, so any
subsequent visitation of the AST won't run out of stack space either.

Change-Id: Id2111a49509132997f5fbe4bb12c92c729ec2522
Task-number: QTCREATORBUG-12673
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-07-22 15:45:02 +02:00
Eike Ziller
e7ea94b688 Merge remote-tracking branch 'origin/3.2'
Conflicts:
	src/plugins/git/gerrit/gerritparameters.cpp
	src/plugins/git/gerrit/gerritplugin.h
	src/plugins/git/gitclient.cpp

Change-Id: Ie7719cfe45489b72d64260e729dcce3760f33bec
2014-07-17 12:42:04 +02:00
Erik Verbruggen
0bcb6d090e C++: initialize class field.
Change-Id: I3bcc08356951518d9c7c3ae7974b475370112dfe
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-07-16 15:06:00 +02:00
Eike Ziller
04fdbb0e21 Merge remote-tracking branch 'origin/3.2'
Change-Id: Ifa095e8503bc9bf47389d34251301cae67a944f8
2014-07-11 16:08:27 +02:00
Nikolai Kosjar
33a80e56cc C++: Fix return type of lambda
Relying on "_type" for the lambda was wrong.

In case of the bug report the return type of the lambda happened to be
the template class. Because of that Clone never stopped cloning.

Change-Id: I377d12e6a8278198abd1488fbdbc89b4157c1357
Task-number: QTCREATORBUG-12631
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-07-10 12:12:46 +02:00
Eike Ziller
0016e385ab Merge remote-tracking branch 'gerrit/3.2'
Change-Id: I2567b8f19e502777f6566ce573a6970fb62a7521
2014-07-07 17:57:39 +02:00
Nikolai Kosjar
04d655dee0 C++: Fix preprocessor line offsets
In TranslationUnit, the "normal" lines are based on utf16char offsets,
but the preprocessor lines were based on byte/latin1 offsets.

The preprocessor lines are now based on utf16char offsets, too.

Task-number: QTCREATORBUG-7356
Change-Id: I3c41d1dcee8e9e487210f36da806b0229d3f4cd0
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-07-04 14:03:44 +02:00
Nikolai Kosjar
8ff225d9d6 C++: Fix (Find)LocalSymbols for lambda parameters
Change-Id: I5cb69749b4f15e4f70dea410aa6f943c4189c502
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-07-04 12:35:13 +02:00
Nikolai Kosjar
d4ce510974 C++: Fix completion for lambda parameters
Change-Id: I6db51aeba328dbb69ec59082a70be7bc2d95699b
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-07-04 12:34:57 +02:00
Nikolai Kosjar
06e2c3309e C++: Fix "duplicate data type in declaration" for lambdas
The "_type" wasn't reset.

Task-number: QTCREATORBUG-12521
Change-Id: I0d38cb38e270260065313d1235d42f2689385850
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-07-04 12:29:28 +02:00
Nikolai Kosjar
45fa5f9ccb C++: Add a clarifying comment and TODO
Change-Id: If6e6db7c4ca011159e78a27755ff9f665b179300
Reviewed-by: Wang Hoi <wanghoi@126.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-07-04 12:16:38 +02:00
Nikolai Kosjar
b497a34655 CppEditor: Fix always-false-condition
The condition didn't make sense. tk.kind() can't be < T_FIRST_QT_KEYWORD
*and* tk.kind() > T_LAST_KEYWORD at the same time.

Change-Id: Id300ad84f37eeff5081b0389c00d574a9cb23f35
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2014-06-24 17:25:13 +02:00
Orgad Shaneh
ea4b4bff40 C++: Split designator AST
Change-Id: I9bfed2023624c818c0f35f24476693cffeaf2bbc
Reviewed-by: Wang Hoi <wanghoi@126.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-06-24 16:16:58 +02:00
Nikolai Kosjar
38b8940bd4 C++: Fix parsing designators vs lambdas
The introduction of C99 designators led to parsing problems with lambdas
that were passed in as a function arguments.

Fixed by prefering to parse without designators first. This will be
cleaner/clearer once the appropriate "LanguageFeatures" from the Project
Parts will be passed in.

Change-Id: Ia9cb7c4a4c9345e729cf2044e1e5411fe63e33ec
Reviewed-by: Wang Hoi <wanghoi@126.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-06-24 16:14:40 +02:00
Anton Kalmykov
496cfdd21d Add syntax highlight for primitive data types
Syntax highlight rules for keywords are changed to highlight control
keywords and primitive data types separately.

Change-Id: Ifb25be7a97b92589030aa190641320c233dc7f2d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-06-24 15:44:13 +02:00
Nikolai Kosjar
f55cac32b1 C++: Remove initialization of enum variable in DesignatorAST
The tool 'cplusplus-update-frontend' can't handle that and thus will
rewrite that class without this initialization.

The member is properly initialized at use.

Change-Id: I2c8c57be47b5fe953c2518254656e5e38ba90f08
Reviewed-by: Wang Hoi <wanghoi@126.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-06-18 17:19:33 +02:00
Wang Hoi
c56b999fff C: Parser: Support parsing of c99 designated initializers
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: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-06-17 16:23:23 +02:00
Christian Kamm
e85c6f4b38 C++11: Fix parsing of expressions like vector<int>{1}.
The parser considers '{' an operator and thus thought
"template-id {" couldn't possibly be valid. This patch adds
'{' as an exception to the rule.

Change-Id: I40730fcdc5cade48566b4c8b6fde390f455bbdba
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-06-16 20:06:58 +02:00
Eike Ziller
2786250c17 Merge remote-tracking branch 'origin/3.1'
Conflicts:
	qtcreator.pri
	qtcreator.qbs
	src/shared/qbs

Change-Id: Iba59e41db72e2afdf594f1f7003215d7d8d1e6d3
2014-06-13 10:51:51 +02:00
Orgad Shaneh
d0f00cc29d C++: Whitespace fixes in parser
Change-Id: I409699225b5f42db7ecb6c2dc8d150c1a66ee23c
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-06-12 16:04:38 +02:00