summaryrefslogtreecommitdiff
path: root/src/libs/3rdparty/cplusplus/Parser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* C++: Support __thread and thread_localOrgad Shaneh2013-11-261-0/+3
| | | | | | | Task-number: QTCREATORBUG-7679 Change-Id: I794f52b2bcfb6c78ceef86ec53b6ed32b3d53d9f Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Avoid warning when compilation with MSVC2013Yuchen Deng2013-11-121-1/+1
| | | | | | | | warning: C4005: 'va_copy' : macro redefinition Change-Id: Ib2bfd2229cb3ae00e084dd6df7a4558a5a766d55 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* CPlusPlus: Make (sub-)languague selection more generichjk2013-10-151-82/+63
| | | | | Change-Id: I4e2df6992b446adec662ab07671acd41715e41fd Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: Parse MEMBER in Q_PROPERTY()Nikolai Kosjar2013-10-091-11/+14
| | | | | | | | | MEMBER was added in Qt5. Task-number: QTCREATORBUG-10068 Change-Id: Ic6c15a0e5ee8981ab98e4c12fc1521dc281b731f Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: Add parser support for @throw statements.Erik Verbruggen2013-08-211-0/+23
| | | | | Change-Id: I366733ec821ee264f182f4d4a3cf69cdada20cfc Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: handle @try statements in the parser.Erik Verbruggen2013-07-191-0/+48
| | | | | | | | | No semantic analysis yet, but this prevents the parser from generating bogus diagnostics. Task-number: QTCREATORBUG-9309 Change-Id: I2ec575a8474cd51bfa97b17678d3da71ab8dcd7a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: add semantic support for C++11 alias decls.Erik Verbruggen2013-06-061-1/+3
| | | | | | | Task-number: QTCREATORBUG-9386 Change-Id: Ia68f3866c122ca5261dd73b2c740b47fb15744fc Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: improve support for anonymous classesPrzemyslaw Gorszkowski2013-04-191-0/+6
| | | | | | | | | | | | | | | | | | | Fix: * highlighting * find usages * follow symbol * code completion Task-number: QTCREATORBUG-6497 Task-number: QTCREATORBUG-8963 Task-number: QTCREATORBUG-3610 Task-number: QTCREATORBUG-7579 Change-Id: I3dcaf1c515d0199c3e6bee72284fbb40064686ee Reviewed-by: Petar Perisin <petar.perisin@gmail.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: Inline {TranslationUnit,Parser}::blockErrorshjk2013-04-181-3/+0
| | | | | | | As indicated by profiling. Change-Id: I04d741dcc6200eb351d7aec316572e0e94ef5bec Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: Fix warning about comparing unsigned vs. intNikolai Kosjar2013-04-151-1/+1
| | | | | Change-Id: Icd72f6358a5e90a292178b1d78f80d42da2ab846 Reviewed-by: hjk <hjk121@nokiamail.com>
* C++: Reduce calls to translationUnit->tokenCount()hjk2013-04-151-2/+3
| | | | | Change-Id: I59527ded34873286072be51c6a141dffcbf93406 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* CPlusPlus: fixed parsing function-try-catch with ctor-initializerSergey Shambir2013-04-091-34/+73
| | | | | | | | | | C++ standard defines that 'try' should be before optional ctor initializer, so wrong order changed. Added documentation to parseTryBlockStatement and new test. Task-number: QTCREATORBUG-9064 Change-Id: Id19cdc53c034cb1232ae27e0bfe36d85b7ad0452 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* cplusplus/parser: removing spurios QT dependencyFawzi Mohamed2013-01-161-1/+0
| | | | | Change-Id: Id69343ee12690f2393f3d4e03cf2b40ebbaa8613 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: fix constructor definition parsing.Francois Ferrand2013-01-081-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | When a constructor is defined with a single, unnamed argument of a custom type without extra type specifiers (const...), then the constructor was not identified as such. There was an heuristic in case the constructor was in the class definition, but not if the the constructor was defined later. Examples: class Arg; class Other; class Foo { Foo(Arg /*arg*/); // working Foo(const Arg /*arg*/); // working Foo(int /*arg*/); // working Foo(Other /*arg*/) {} // working }; Foo::Foo(Arg /*arg*/) {} // used not to work, fixed Foo::Foo(Arg arg){} // working Foo::Foo(const Arg /*arg*/) {} // working Foo::Foo(int arg) {} // working Change-Id: I741e4ba62672ddc99a837fdcdc27996fba5ae6c7 Reviewed-by: hjk <qthjk@ovi.com>
* Remove braces for single lines of conditionsOrgad Shaneh2013-01-081-19/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | #!/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 else res.gsub!('} else', 'else') res.gsub!(/\n +} *\n/m, "\n") res.gsub(/ *{$/, '') end } s.gsub!(/ *$/, '') File.open(file, 'wb').write(s) if s != orig } Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc Reviewed-by: hjk <qthjk@ovi.com>
* Add whitespace after control keywordsOrgad Shaneh2012-11-281-1/+1
| | | | | | | | find -name \*.cpp -o -name \*.h | \ xargs sed -Ei 's/ (for|foreach|if|switch|while)\(/ \1 (/g' Change-Id: I9efdff4bf0c8c01a52baaaeb75198483c77b0390 Reviewed-by: hjk <qthjk@ovi.com>
* C++: Store lambda captures in the code model.Nikolai Kosjar2012-11-071-12/+25
| | | | | | | | | Done-with: Erik Verbruggen Task-number: QTCREATORBUG-7968 Task-number: QTCREATORBUG-7949 Change-Id: I0cf727052d0a3536ed96ee894b18768c9538c213 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: added some notes regarding QTCREATORBUG-7968Erik Verbruggen2012-10-111-0/+2
| | | | | Change-Id: Ia7a0e4b416ba6ef768d76595d8576262a828ae78 Reviewed-by: David Schulz <david.schulz@digia.com>
* C++11: Fix parsing of ambiguous declarators.Christian Kamm2012-09-281-3/+4
| | | | | | | Task-number: QTCREATORBUG-7921 Change-Id: Ia94c30886321e09028547a47f83d2a0c57f3980f Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Fix bug with parsing ctor initializers.Christian Kamm2012-09-251-1/+1
| | | | | | | Task-number: QTCREATORBUG-7919 Change-Id: I12307c3fb6c20424c8b5aaf564a031924c755d25 Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Fix and add test for simple decltype uses.Christian Kamm2012-09-241-1/+0
| | | | | Change-Id: I7f843fa96e33671ecb135b9db6f68d9f2cbf2fac Reviewed-by: hjk <qthjk@ovi.com>
* Fix bug with expression list parsing.Christian Kamm2012-09-201-3/+2
| | | | | | | | Empty lists would have a single null entry, instead of being null entirely. Change-Id: I5114cf1e0ecdbcde5631511ad03a8d559668ea80 Reviewed-by: hjk <qthjk@ovi.com>
* C++11: More (expression-list) or brace-init-list.Christian Kamm2012-09-191-11/+4
| | | | | | | | | This time in the 'new' expression. Changed it to make new C(1, abc...) and new C{1, abc} work. Change-Id: I7232798fd083b653ee04ef9ede386d6536133e16 Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Allow for typename Foo<T>{}, Foo{} and int{}.Christian Kamm2012-09-191-18/+27
| | | | | | | As a postfix expression. Change-Id: I65cae0571080a9fb699af61c661328ef06f97890 Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Make expression-list expand to initializer-list.Christian Kamm2012-09-191-33/+6
| | | | | | | | | | | | | This will fix a couple more places where brace-init-lists and pack expansions are allowed but are not currently accepted by the parser. For example: foo(abc...); now parses correctly. Change-Id: I93710cef35154fea8437329f3174e4a2d56637b8 Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Allow brace-init-list in default argument declaration.Christian Kamm2012-09-191-1/+4
| | | | | Change-Id: Iab707d855f98982697365f9a4cd7832877e64d17 Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Fix use of >> in template arguments.Christian Kamm2012-09-191-9/+14
| | | | | Change-Id: Ic99ca897e7a3b9c82cf8c5093a90bf9c88dbb0ed Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Make 'enum struct', enum-base and opaque enum decls work.Christian Kamm2012-09-191-12/+20
| | | | | | | | For declarations like: enum struct Foo : long int; Change-Id: Id813efdbc31c8d70a4b40bb0101dc33a8dd2556a Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Parse alias declarations.Christian Kamm2012-09-191-0/+46
| | | | | | | | The parser no longer fails declarations like: using Foo = std::vector<int>::iterator; Change-Id: Ib3a552ebbe0147fa138db6448a52cdba8f9b9207 Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Allow brace-init-list in range-for statement.Christian Kamm2012-09-191-1/+5
| | | | | | | | Also drop the unused 'initializer' member from RangeBasedForStatementAST. Change-Id: I078ebbc85cafa643af4bfe62d698bf7de71360e4 Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Add alignof() expression.Christian Kamm2012-09-191-0/+18
| | | | | Change-Id: Id3fb30b9a16ea724bab0d5b05e8cbddb0064e6eb Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Accept ref-qualifiers in function declarators.Christian Kamm2012-09-191-2/+19
| | | | | | | | | | Means void foo() const &; void bar() &&; and the corresponding pointer-to-member declarators now parse. Change-Id: Idbf295bd4f51cd5d9e38efcac1940b8cc2e32fce Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Fix parsing of noexcept(constant-expression).Christian Kamm2012-09-191-1/+3
| | | | | Change-Id: I745ce4a4810a995d80ea0da12ec993d84637223f Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Allow uniform initialization in ctor init lists.Christian Kamm2012-09-191-13/+39
| | | | | | | | | So class C { C() : _x{12}, _y({12}) {} }; now parses correctly. Change-Id: I4281dcb0541a86b550e74630cad6ae0a59fef1b4 Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Don't fail on = default and = delete initializers.Christian Kamm2012-09-191-0/+13
| | | | | | | These are converted to IdExpr(SimpleName(token)) initializers. Change-Id: I1e85c4b261ca028dc75ffe6c00e1090630c2957c Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Allow brace initializers in return statements.Christian Kamm2012-09-191-1/+4
| | | | | | | Like return {1, 2}; Change-Id: I7442da1866b0106bc075783653c95c16ebedb51a Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Allow brace initializers in assignment expressions.Christian Kamm2012-09-171-2/+7
| | | | | | | | | Like: var += {1, 2}; in a function context. Change-Id: I3936c97c4fcb6b3dcac2979e0508d422d47fddfc Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Allow brace initializer lists in more places.Christian Kamm2012-09-171-1/+9
| | | | | | | | | | This allows them to be used in declarator initializers that expect an expression list in parentheses. Like T v({1, 2}, 3, 4); Change-Id: I62e1ffd355ca88f7acbb8708c9b40c8310489ca3 Reviewed-by: hjk <qthjk@ovi.com>
* C++: Rename NewPlacementAST to ExpressionListParenAST.Christian Kamm2012-09-171-6/+8
| | | | | | | | It'll be reused as the initializer expression for declarators that are followed by "( expression-list )". Change-Id: I6c76a76641941874ef1ed21daa7b6e057c6d170f Reviewed-by: hjk <qthjk@ovi.com>
* C++11: Allow for brace initializers like T v{1, 2}.Christian Kamm2012-09-171-1/+5
| | | | | | | And add a basic test. Change-Id: I3b8b87d51a9da154758d17380bba5922795f675c Reviewed-by: hjk <qthjk@ovi.com>
* Merge remote-tracking branch 'origin/2.6'Eike Ziller2012-08-231-4/+17
|\
| * C++: Introduce C++11 raw string literalsLeandro Melo2012-08-231-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | 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: Roberto Raggi <roberto.raggi@nokia.com>
| * Remove some unused member variablesTobias Hunger2012-08-221-2/+0
| | | | | | | | | | Change-Id: I4b1bcfe8da32bd48c601d1efdb7c3aac1d39cbce Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
* | Added support for override/final and enum classesSergey Shambir2012-07-301-5/+69
|/ | | | | Change-Id: I6dfe9dd606781046ff5a1ed61315741d2f332cb8 Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
* C++: Parse emit/Q_EMIT properlyLeandro Melo2012-06-281-0/+17
| | | | | | | | | | | | | | | | | 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: Roberto Raggi <roberto.raggi@nokia.com>
* C++: Introduce unicode char/strings supportLeandro Melo2012-06-061-3/+23
| | | | | | | | | | | | | | 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: hjk <qthjk@ovi.com>
* C++: Also parse static_assert as top-level declarationLeandro Melo2012-06-051-6/+21
| | | | | | | Add some checks for C++11 flag as well. Change-Id: Ic5ee81d72bc88a22e71b324ef01014791b833604 Reviewed-by: hjk <qthjk@ovi.com>
* Fix invalid decltype error recovery which resulted in crashes.Erik Verbruggen2012-03-281-4/+2
| | | | | | | Task-number: QTCREATORBUG-7174 Change-Id: I653db71adc45586cd8518ffd96118425fd3763be Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* [C++] Add error recovery for namespace declarations.Erik Verbruggen2012-02-281-1/+26
| | | | | | Change-Id: I884ff9901c95467524e5eba38e91f75992d30e14 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Flex Ferrum <flexferrum@gmail.com>
* [C++] Correctly parse inline constructors for templates.Erik Verbruggen2012-02-231-1/+2
| | | | | | | | This failed for: template<class T> inline S<T>::S(nullptr_t):_p(0){} Change-Id: Ibb48f403a66cb19567e65270aa166849ee81a162 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>