Commit Graph

157 Commits

Author SHA1 Message Date
IOBYTE 16788df055 template simplifier: various small fixes (#1916)
* fix adding instantiation of first argument to an instantiation

* add support for function pointer template variables

* fix more cases where templates ending in ">>" are changed to end in "> >"

* fix travis build

* standard types can't be a template parameter name

* remove redundant level == 0 checks

* fix lambda in template variable

* fix a test
2019-06-28 11:14:20 +02:00
IOBYTE 246576fceb Fixed #9178 (Assertion `brackets1.empty() == false' failed on valid C++ code) (#1905)
This fixes a nasty intrinsics related bug causing instantiations that
shouldn't happen.
2019-06-17 21:18:27 +02:00
Paul Fultz II b466415bb4 Fix syntax error in issue 9155 (#1885) 2019-06-15 09:48:22 +02:00
IOBYTE 75720528b0 template simplifier: add 2 new template parameter simplifications (#1884)
* template simplifier: add 2 new template parameter simplifications

int{} -> 0
decltype(int{}) -> int

This fixes reduced test cases like #9153.  I'm not sure they will help
real world code that much.

It was necessary to increase the pass count to 4 to get #9153 completly
simplified.

* relax decltype(type{}) simplification to any type
2019-06-15 09:46:32 +02:00
IOBYTE 2a4b28c267 Fixed #9155 (Syntax error on valid C++ code) (#1880)
Refactored simplifyTemplateAliases to iterate over template type aliases
rather than instantiations. This fixed template type aliases that were
not templates.

Don't instantiate templates in template type aliases. They will get
instantiated once the type alias is instantiated. This required
increasing the template simplifier pass count to 3 so one of the
existing tests continued to work.
2019-06-12 07:44:48 +02:00
IOBYTE 5af8beecf6 template simplifier: specialized member class not recognized causing wrong instantiation (#1876)
Specialized member classes declared outsize the class were not
recognized. This caused the the member class to be instantiated rather
than the specialized class. We already had a test for this but it was
wrong so it went unnoticed.
2019-06-09 08:11:59 +02:00
IOBYTE 7a87786cbc template simplifier: class or typename can't be a name (#1875)
* template simplifier: class or typename can't be a name

* struct can't be a name
2019-06-08 07:27:53 +02:00
IOBYTE ce9fdd181d Add regression test for #9146 (Syntax error on valid C++ code) (#1867) 2019-06-02 10:23:47 +02:00
IOBYTE bee248b2de token simplifier: fix namespace, token link and syntax error support for template type aliases (#1863) 2019-06-01 10:52:29 +02:00
IOBYTE 1e7f5010eb template simplifier: fix expansion of template arguments in default parameter instantiation (#1857) 2019-05-28 21:32:37 +02:00
IOBYTE e8692b012f template simplifier: partial fix for instantiation of templates with type trait parameters (#1855) 2019-05-27 20:51:52 +02:00
Paul Fultz II 312fdf157b Fix issue 9144: Syntax error with type intrinsics (#1852)
* Fix issue 9144: Syntax error with type intrinsics

* Only run when using cpp
2019-05-27 06:54:21 +02:00
Paul Fultz II cb7f925f5e Fix issue 9109: Syntax error for valid C++ code 2019-05-24 10:44:08 +02:00
IOBYTE 5efb23ffff template simplifier: fix instantiation of variadic template with no arguments (#1848)
* template simplifier: fix instantiation of variadic template with no arguments

* fix white space change

* add support for <class...>

* add variadic template flag
2019-05-23 20:53:26 +02:00
IOBYTE 592ff56b90 template simplifier: fix single parameter template with default value (#1842)
* template simplifier: fix single parameter template with default value

* fix derived class with single default argument
2019-05-19 19:19:57 +02:00
Daniel Marjamäki 57c6628732 Revert 'Cleaning up unsimplified templates'. This fix caused problems. 2019-05-16 21:11:04 +02:00
Daniel Marjamäki d58d4273f9 Cleaning up unsimplified templates 2019-05-11 13:00:03 +02:00
IOBYTE baeae95bac template simplifier: fix a template alias TODO test (#1823) 2019-05-06 19:06:46 +02:00
Daniel Marjamäki f6527fcd9b fixed tests, unused templates are removed by default 2019-05-05 19:40:58 +02:00
IOBYTE e786c6b7d4 partial fix for #8663 (Stack overflow with template disambiguator) (#1801)
This fixes simplifyUsing to remove 'typename' and 'template' from type
aliases of the form: using T3 = typename T1::template T3<T2>;

This lets the template simplifier instantiate the type alias which will
then remove the using type alias.

The crash will still happen if there is no instantiation because the
type alias will not be removed.  The type alias is what cppcheck is
crashing on after the template simplifier and that still needs fixing.
2019-04-21 06:46:16 +02:00
amai2012 361fc44005 Adjust more test results for invalid code 2019-04-19 20:53:07 +02:00
IOBYTE 5cdde701ba template simplifier: add minimal template template support (#1779) 2019-04-04 06:07:49 +02:00
IOBYTE 9f3ecdde31 Fixed #9076 (Template Simplifier : template < template <typename> T >) (#1777)
This does not add support for template templates.  It only skips the
template template parameter.
2019-04-03 06:02:38 +02:00
Daniel Marjamäki fbc769266c Fixed #9060 (TemplateSimplifier::templateParameters : var <...>) 2019-03-31 16:29:28 +02:00
IOBYTE d88ee2d6a2 Fixed #9070 (Segmentation fault in TemplateSimplifier::simplifyTemplateAliases (scram package)) (#1771)
This only fixes the crash.  It does not fix the underlying problem of
template using with templates of templates causing the use of deleted
instantiations.
2019-03-30 06:53:17 +01:00
IOBYTE 10fcf731d9 Fixed #9021 (template simplifier: crash in simplifyCalculations) (#1757) 2019-03-25 14:56:51 +01:00
IOBYTE 40d7d5a3d0 template simplifier: fix return type of out of line member function when it is a template parameter (#1723) 2019-03-03 19:42:46 +01:00
IOBYTE b222953bae template simplifier: only constant fold template instantiation arguments (#1721)
* template simplifier: only constant fold template instantiation arguments

* Fix travis build.
2019-03-03 07:40:55 +01:00
IOBYTE b78b3c6ab1 Fixed #9005 (Syntax error on valid C++) (#1716) 2019-03-01 08:18:53 +01:00
Armin Müller f4b5b156d7 Typos found by running "codespell" (#1715) 2019-03-01 01:01:39 +01:00
IOBYTE 98bf112352 template simplifier: fix recursive variable templates (#1711) 2019-02-28 08:30:04 +01:00
IOBYTE 9d75b718d3 template simplifier: remove use of simplifyTokenList2 in tests (#1705) 2019-02-27 07:06:34 +01:00
IOBYTE bf85767829 template simplifier: make sure all instantiations are found and expan… (#1696)
* template simplifier: make sure all instantiations are found and expanded in #5097

* template simplifier: check output on another test

* template simplifier: add output to another test
2019-02-26 06:41:04 +01:00
IOBYTE 3f257d6310 template simplifier: instantiate template class when something inside… (#1695)
* template simplifier: instantiate template class when something inside class instantiated.

* template simplifier: add output to another test that now works
2019-02-25 21:01:34 +01:00
IOBYTE 41d87d6306 template simplifier: check output of a few crash and hang checks that now generate correct output (#1689) 2019-02-24 10:31:49 +01:00
IOBYTE 8bd5b3eccf Fixed #8962 ("(debug) Unknown type 'T'" with template typename parame… (#1671)
* Fixed #8962 ("(debug) Unknown type 'T'" with template typename parameter)

Only simple one parameter template functions with one function parameter
are supported.

* Added TODO test case for FIXME.
2019-02-14 11:48:59 +01:00
IOBYTE 155e4ce912 Fixed #8971 ("(debug) Unknown type 'x'." using alias in class members) (#1653)
* Fixed #8971 ("(debug) Unknown type 'x'." using alias in class members)

* template simplifier: partial fix for #8972

Add support for multi-token default template parameters.

* template simplifier: fix for #8971

Remove typename outside of templates.
2019-02-09 08:34:59 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
IOBYTE 7025254c26 Fixed #8969 (syntax error: template) (#1647)
Fixed template detection to handle multi-token template parameters.
2019-02-07 08:50:49 +01:00
IOBYTE 1faae52d06 Fixed #8960 ("(debug) Unknown type 'x'." with alias in template class alias) (#1643)
* Fixed #8960 ("(debug) Unknown type 'x'." with alias in template class alias)

This commit adds non-template type alias support to the template
simplifier.  Only relatively simple type aliases are supported at this
time. More complex types will be added later.

--debug-warnings will show unsupported type aliases.

Type alias support will be removed from the symbol database in the
future.  Type alias tests have been removed from the symbol database
tests.

* Add the changes.

* Fix codacy warning.

* Fix travis warnings.
2019-02-05 08:52:23 +01:00
IOBYTE d08aa666f6 template simplifier: fix crash on windows (#1639)
* template simplifier: fix crash on windows

Use right token when searching for template type alias to delete.

* template simplifier: fix a cppcheck warning
2019-02-01 06:59:49 +01:00
IOBYTE 98fc6d1d32 Fixed #8959 ("(debug) Unknown type 'x'" with using/alias) (#1635)
* Fixed #8959 ("(debug) Unknown type 'x'" with using/alias)

* fix cppcheck warning
2019-01-31 23:57:37 +01:00
IOBYTE 68bbe15116 template simplifier: fix missing instantiation (#1627) 2019-01-26 07:08:54 +01:00
IOBYTE cb1a1df0fa template simplifier: fix out of line member function scope and use more full name matching (#1617) 2019-01-24 07:21:22 +01:00
IOBYTE ec8bc785a2 template simplifier: add support for using namespace when instantiating templates (#1615) 2019-01-23 08:53:01 +01:00
IOBYTE 1acbdde302 Fixed #7417 ("syntax error" in valid code containing explicitly specialised variable template) (#1604) 2019-01-18 21:12:39 +01:00
Daniel Marjamäki 8dd641b8be Use OVERRIDE in test 2019-01-12 15:45:25 +01:00
practicalswift 0a1b3a9d6f Fix typos (#1568) 2019-01-06 17:15:57 +01:00
IOBYTE 32a5d66e5b Fixed #8927 (SIGSEGV below TemplateSimplifier::expandTemplate) (#1564) 2019-01-05 11:14:09 +01:00
IOBYTE 3b9828a132 template simplifier: fix crash on daca c++-annotations project (#1556)
Fix scope info bug on derived template class which caused a use after
free crash when deleting a template forward declaration in a different
scope.
2019-01-02 07:15:45 +01:00