Commit Graph

279 Commits

Author SHA1 Message Date
IOBYTE 33b74a04ab Add union support to template simplifier. (#1398) 2018-09-26 06:23:12 +02:00
orbitcowboy d08b39c915
Improved const correctness of local variables. There are no functional changes intended. (#1392) 2018-09-23 20:24:51 +02:00
IOBYTE e9a44f70b2 Remove out of line member functions of instantiated template classes. (#1377)
* Remove out of line member functions of instantiated template classes.
2018-09-14 14:16:34 +02:00
IOBYTE 7224ee27d9 Fixed #8122 (simplifyTemplates: constructor outside template class not simplified properly) (#1361) 2018-09-02 17:49:13 +02:00
IOBYTE 341dee4a07 Fixed #8725 (Template out of line function return type missing when instantiated.) (#1360) 2018-09-02 08:35:05 +02:00
IOBYTE 508e8c234b Fixed #8683 (Using deleted token with multiple template instantiations.) (#1353)
* Fixed #8683 (Using deleted token with multiple template instantiations.)

* Fixed #8321 (heap use after free: templatesimplifier)

* Add a flag to Token indicating that it has a pointer to it.

* Run dmake

* Fix one source of list pointers to deleted tokens.

Refactor TemplateSimplifier class to get access to template lists.
Remove many function parameters now that they are class variables.
Fix one source of list pointers to deleted tokens.
Add tests with no output to catch crashes.

* Run dmake again.

* Make 2 more functions private.

* Make requested changes.

* Missed one change request.

* Use TokenList rather than Tokenizer.

* Move TokenAndName constructor to cpp file so token.h is not needed in header file.
2018-09-01 11:26:10 +02:00
Daniel Marjamäki faea8e1c02 Refactoring: Use range for loops 2018-07-15 14:45:15 +02:00
Daniel Marjamäki 9717a5afad Rename private member variables 2018-06-17 19:24:40 +02:00
Daniel Marjamäki ef534c2d0d Renamed _codeWithTemplates 2018-06-16 22:03:04 +02:00
Daniel Marjamäki 79ffe1d4fc Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
rebnridgway d3b231214d TemplateSimplifier optimisation. measured time improvement for cryptopp/test.cpp is ~8.4s => ~8.35s 2018-06-02 13:49:14 +02:00
Daniel Marjamäki 7163210f72 Fixed #8605 (Segmentation fault below TemplateSimplifier::simplifyCalculations) 2018-06-01 23:03:53 +02:00
Daniel Marjamäki 02f9ab38b4 simplifyCalculations: Made this function ~30% faster when analysing lib/tokenize.cpp 2018-05-31 06:36:59 +02:00
amai2012 8d55d361ae #8602 Template default parameter without name yields syntax error 2018-05-30 17:09:31 +02:00
Daniel Marjamäki 4c9bde277a Refactoring: Use ranged for in TemplateSimplifier 2018-05-30 14:40:38 +02:00
Daniel Marjamäki f7148cbaa9 Refactoring: Renamed iterator 2018-05-30 14:33:55 +02:00
Daniel Marjamäki cc77a6aa62 Code refactoring 2018-05-29 22:41:37 +02:00
orbitcowboy 5861a3844a Running astyle [ci skip]. 2018-05-29 17:32:55 +02:00
orbitcowboy de66eedd54 Improved const correctness of local variables. 2018-05-29 17:33:43 +02:00
IOBYTE d567b878ba Fix template instantialion failure for qualified template type. (#1237) 2018-05-16 15:24:23 +02:00
Daniel Marjamäki d8622ea5f8 simplifyCalculations: Removed redundant goback variable 2018-05-14 23:06:10 +02:00
Daniel Marjamäki 29dc42ff67 Removed unreachable code 2018-05-14 22:50:30 +02:00
Daniel Marjamäki 98e3f373e9 Revert "Optimize usage of TemplateSimplifier::simplifyCalculations"
This reverts commit 3044612fe9.

I got a report about a significant slowdown for a code.
2018-05-11 21:26:28 +02:00
Daniel Marjamäki 3044612fe9 Optimize usage of TemplateSimplifier::simplifyCalculations 2018-05-11 14:48:59 +02:00
Daniel Marjamäki f336c2efe7 Refactoring; Renamed Scope::classStart and Scope::classEnd 2018-04-27 22:36:30 +02:00
PKEuS d2146844dd Refactorizations:
- Replace several push_back-calls by emplace_back
- Replace some x = x.substr(0, y) calls by x.erase(y)
2018-04-11 09:44:35 +02:00
jrp2014 b6504c70ca Improve constness 2018-04-04 21:51:31 +02:00
orbitcowboy ec0cc4e29c templatesimplifier: Removed redundant local string variable. (#1041) 2018-01-20 22:26:48 +01:00
Daniel Marjamäki b08c1868bc Fixed Cppcheck warning 2018-01-15 22:03:23 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki bbeff99cc3 Fixed #6930 (Token: need function that says if the token comes from instantiated template argument) 2018-01-11 09:41:22 +01:00
Daniel Marjamäki 8c33a95b49 Refactoring: moved method from Tokenizer to TokenList 2018-01-07 14:07:34 +01:00
Daniel Marjamäki 98b45ffbc0 Fixed #8314 (TemplateSimplifer crash) 2018-01-06 15:16:03 +01:00
Daniel Marjamäki 943693acfb TemplateSimplifier: Improved code for template aliases 2018-01-06 08:40:06 +01:00
Martin Ettl e33fe91b1a Micro optimize std::string::find() calls searching for a single space. 2018-01-05 22:24:28 +01:00
Daniel Marjamäki d6dae27803 Fixed Cppcheck postincrement warnings 2018-01-05 17:29:40 +01:00
Daniel Marjamäki 2c5225af43 Fixed use-after-free found by asan 2018-01-05 17:06:02 +01:00
Daniel Marjamäki 04c57381ea Fixed #8315 (heap use after free: templatesimplifier) 2018-01-05 16:10:13 +01:00
Matthias Krüger 94790620d6 templatesimplifier: fix two warnings about nonexplicit constructors.
Was:
[lib/templatesimplifier.cpp:37]: (style) Class 'FindToken' has a constructor with 1 argument that is not explicit.
[lib/templatesimplifier.cpp:47]: (style) Class 'FindName' has a constructor with 1 argument that is not explicit.
2018-01-05 15:53:13 +01:00
Daniel Marjamäki f74c19bbed Refactoring lookups in TemplateSimplifier 2018-01-05 15:27:43 +01:00
Daniel Marjamäki a95108ebe3 TemplateSimplifier: Fix incorrect recursion when template is reused inside itself 2018-01-03 23:05:57 +01:00
Dmitry-Me 70817b3d4e Remove redundant check 2018-01-01 03:06:17 +03:00
Daniel Marjamäki 1cbeec26c6 Replace Token::Match with Token::simpleMatch 2017-12-30 22:43:44 +01:00
Daniel Marjamäki f6fcf01cc6 Fixed #7868 (TemplateSimplifier: template specialization fails) 2017-12-30 22:14:48 +01:00
Daniel Marjamäki 03a4c84fec Rename variables 2017-12-30 12:27:55 +01:00
Daniel Marjamäki a8f73055ad Templates: Fixed scope problem 2017-12-30 09:00:19 +01:00
Daniel Marjamäki fc1ac180e6 Fixed #6218 (Template type aliasing misdetection) 2017-12-29 22:47:07 +01:00
Daniel Marjamäki caf9f22015 Rename method TemplateParametersInDeclaration => getTemplateParametersInDeclaration 2017-12-28 22:10:10 +01:00
Daniel Marjamäki 42bcb6d417 use early continue 2017-12-27 22:29:45 +01:00
Daniel Marjamäki 469cb7e6df TemplateSimplifier: Fix instantiations when template parameter is a template 2017-12-26 22:34:39 +01:00