Alexander Mai
7112725d38
Simplify code (repair travis build)
2015-10-18 16:04:49 +02:00
Alexander Mai
21efa992e3
#6865 TemplateSimplifier::expandTemplate doesn't terminate on invalid code. Add some another syntax check on templates to avoid problems later on.
2015-10-18 15:47:37 +02:00
Daniel Marjamäki
ec87b09d89
Fixed #7056 (iscast does not handle '(ulong)~0' properly, Tokenizer::simplifyCalculations wrongly simplifies '(ulong)~0' to 'ulong~0')
2015-10-17 18:58:13 +02:00
Martin Ettl
8936985c5c
#7001 : Fixed templatesimplifier.cpp: Remove double include.
2015-09-18 12:20:41 +02:00
PKEuS
a720153e1e
Refactorization: Removed redundant code for syntax error handling in templatesimplifier.cpp and symboldatabase.cpp
2015-08-19 19:29:48 +02:00
PKEuS
1627b19dd6
Refactorizations:
...
- Call std::string::find() with char instead of char* where possible
- Avoid string copying
- Optimized several Token::tokAt/strAt calls
2015-08-16 10:33:51 +02:00
PKEuS
ee4a5843bb
Some small refactorizations
2015-08-15 19:46:31 +02:00
PKEuS
4d80df2f4a
Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
...
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Simon Martin
af1b0cfddf
Ticket #6835 : Don't get confused by parentheses while detecting template parameter default values.
2015-07-17 21:30:34 +02:00
Alexander Mai
e75662aaf1
#6792 segmentation fault (invalid code) in TemplateSimplifier::templateParameters. Avoid null pointer access
2015-06-25 20:48:05 +02:00
Alexander Mai
f806d945a1
Refactoring: Allow TemplateSimplifier to throw InternalErrors by itself.
2015-06-23 20:53:57 +02:00
Martin Ettl
9236ea4a20
Running astyle, no functional changes.
2015-05-29 19:15:41 +02:00
amai2012
e41beb4f8d
Fix #6718 and #6719 (crashes on garbage code).
...
Local fixes avoiding access to NULL-token. Also minor correction to
TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates()
2015-05-29 18:34:00 +02:00
Alexander Mai
098391ee32
#6715 segmentation fault (invalid code) in TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates. Harden TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates()
2015-05-28 21:38:20 +02:00
Alexander Mai
6f96634759
#6276 clang: -fsanitize=integer warnings. Fix unwanted integer overflow in TemplateSimplifier::useDefaultArgumentValues() and Tokenizer::simplifyQtSignalsSlots()
2015-05-03 15:21:58 +02:00
Frank Zingsheim
4ceed51bfb
Fixed #6607 (Crash triggered by TemplateSimplifier::useDefaultArgumentValues)
2015-05-01 17:13:02 +02:00
PKEuS
b6709294a8
Fixed ...... in template instantiations (similar to constconst from #6604 )
2015-04-13 17:03:06 +02:00
Matthias Krüger
42f0955e3f
Move more setting checks out of loops and use const bools instead. Reorder a few related checks.
...
Follow up to eedcb6abcb
.
2015-04-10 14:31:19 +02:00
Simon Martin
0f7f08644c
Show template instantiation and not definition location in template instantiation debug message.
2015-04-05 14:54:24 +02:00
Daniel Marjamäki
aacd9b9f6b
Fixed #6586 (Tokenizer: '>>' is wrongly tokenized as '> >' - if (n1 < len>>1))
2015-04-03 20:25:49 +02:00
PKEuS
0d37c4df04
Fixed three unique crashs on garbage code ( #6613 ).
...
Removed redundant copy of string in templatesimplifier.cpp
2015-04-01 12:43:24 +02:00
PKEuS
19f770e41b
Fixed #6604 - don't create template instanciations with "const const const const..." patterns.
2015-03-22 11:20:47 +01:00
Daniel Marjamäki
a200e5b32f
Merge pull request #551 from simartin/ticket_4335
...
Ticket #4335 : Properly detect and handle template class specialisations
2015-03-15 07:59:11 +01:00
Simon Martin
520314f9a0
Ticket #4335 : Properly detect and handle template class specializations.
2015-03-15 00:28:33 +01:00
Simon Martin
32a7a178e8
Code simplification now that ">>" is turned into "> >" when it closes template argument lists.
2015-03-14 23:02:10 +01:00
Simon Martin
4c916641cc
Ticket #6347 : Fix use after delete when simplifying template instantiations.
2015-03-14 18:46:17 +01:00
Simon Martin
1d973b882d
Ticket #6567 : Handle member functions in TemplateSimplifier::getTemplateNamePosition.
2015-03-07 21:52:12 +01:00
Daniel Marjamäki
925f077b8a
Fixed #6110 (TemplateSimplifier::simplifyCalculations: wrong simplification of 'if (VG_(strlen)(s)>=3)')
2015-03-02 16:27:00 +01:00
Simon Martin
c4c46be972
Revert fix for #6181 , that caused #6354 and #6414 .
2015-02-14 12:29:05 +01:00
PKEuS
b2835051df
Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0.
2015-01-31 12:32:04 +01:00
Thomas Jarosch
cd4c297dce
Fix segfault in template simplifier
...
When something parsing the template syntax
went wrong, "tok2" was NULL and resulted
in deleting all remaining tokens. Whoops.
Triggered by gcc test suite:
gcc/testsuite/g++.dg/cpp0x/variadic87.C
Tracked down the source of the bug with
valgrind's "--track-origins=yes" switch.
2015-01-18 01:43:43 +01:00
Daniel Marjamäki
ff11ba9847
Updated copyright year to 2015
2015-01-03 12:14:58 +01:00
PKEuS
e03f49360f
Merge pull request #484 from simartin/ticket_6181
...
Ticket #6181 : Properly handle >> terminating template parameter lists.
2014-12-21 12:21:17 +01:00
Simon Martin
4c7a8c5497
Ticket #6181 : Properly handle >> terminating template parameter lists.
2014-12-14 15:14:27 +01:00
Simon Martin
859c6381cc
Ticket #6172 : Properly grok %type%... template parameters.
2014-12-14 14:33:37 +01:00
Simon Martin
cc6b51f2d9
Ticket #6059 : Properly handle class... in parameter lists.
2014-11-07 23:08:54 +01:00
Frank Zingsheim
0e4c508d7b
Fixed #4272 and #6237 (Crash from running out of memory with many templates)
2014-11-01 22:07:24 +01:00
Daniel Marjamäki
d0d2a0faf8
simplifyCalculations: Fix simplification of '( %num% )' when parentheses must be kept
2014-10-10 13:19:25 +02:00
Simon Martin
9ddf857dc7
Ticket #5625 : Simplify constant ternary operator in template parameters.
2014-10-04 20:49:57 +02:00
Dmitry-Me
32f7a789df
Merge overlapping patterns, move declarations
2014-09-17 10:54:53 +04:00
Daniel Marjamäki
29a49d0641
removed some redundant null pointer checks before calling Token::Match
2014-09-14 11:35:04 +02:00
Simon Martin
53b58f0ed9
Refactoring. Use Token::Match instead of hardcoded patterns to increase readability.
2014-09-14 11:26:16 +02:00
Simon Martin
01cf008792
Ticket #6134 : Improve the mechanism differentiating template declarations from template definitions.
2014-09-13 16:44:05 +02:00
Simon Martin
6e10603227
Ticket #6023 : Properly handle template'd default template parameter values.
2014-09-06 20:39:04 +02:00
Daniel Marjamäki
d41ef3a6d0
TemplateSimplifier: Fixed crash caused by null pointer dereference. I don't have a testcase. But the code is suspicious, in the loop we check if tok3 is null and then in the loop head we call tok3->next().
2014-07-15 21:28:52 +02:00
amai2012
9b38ae73c1
Attempt to fix 2 Coverity messages.
...
Replace a few unsigned int by std::size_t
2014-07-07 21:25:30 +02:00
Daniel Marjamäki
d40b77dce2
Removed special 'else if' handling. this is redundant since these are simplified.
2014-07-02 16:16:19 +02:00
orbitcowboy
76f3f67bcf
Fixed fsanitize=undefined: left shift of negative value -10000 in lib/templatesimplifier.cpp.
2014-06-16 10:58:41 +02:00
PKEuS
a04036337d
Fixed #5860 : Don't show returnTempReference for calculations on unknown types
2014-05-24 12:50:04 +02:00
PKEuS
adf38fcfd0
Further include cleanup
2014-05-24 12:50:04 +02:00
Simon Martin
2b809800b6
Ticket #5823 : Properly count template parameters in TemplateSimplifier::useDefaultArgumentValues and handle casts in template parameters' default values.
2014-05-23 23:38:40 +02:00
orbitcowboy
90c1016c74
Fixed #5842 : remove C99 static keyword between [] in tokenizer.
2014-05-13 16:28:28 +02:00
Alexander Mai
be9a566d48
Refactoring/small corrections to fix warnings from clang -fsanitize=undefined 'member call on null pointer'
2014-05-20 21:55:08 +02:00
Mark de Wever
d6db261213
Fixed #5827 (Invalid token match patterns)
2014-05-19 06:31:38 +02:00
PKEuS
5fbd58d98d
Fixed messages of CheckInternal, fixed a false positive.
2014-05-18 20:39:52 +02:00
Simon Martin
e61e1cb13d
Ticket #5786 : Properly handle cv-qualified member pointers as template parameter.
2014-05-14 22:27:31 +02:00
Daniel Marjamäki
4e2c0617d3
Merge pull request #303 from simartin/ticket_5297
...
Ticket #5297 : simplifyCalculations should pass once more on simplified tokens
2014-05-10 10:18:29 +02:00
Simon Martin
1e4902cb65
Ticket #5297 : simplifyCalculations should pass once more on tokens being simplified.
2014-05-10 09:37:56 +02:00
Simon Martin
46d8d81176
Ticket #5774 : Properly handle "typename..." in template parameter list.
2014-05-09 22:20:22 +02:00
Simon Martin
2a6acdf357
Ticket #5605 : Don't consider '>' as a default template parameter value. Don't choke on template parameters with erroneous default values.
...
Ticket #5759 : Properly handle pointers to class members in template parameter lists.
Ticket #5762 : Handle template specialization tokens.
2014-05-08 13:54:56 +02:00
Daniel Marjamäki
6e25280c90
Reverted fix for #5605 since it cause this crash: #5759
2014-05-05 21:11:47 +02:00
Daniel Marjamäki
2f3f42d7f1
astyle formatting
...
[ci skip]
2014-05-03 18:10:49 +02:00
Simon Martin
ffe6a0be2b
Ticket #5605 : Don't consider '>' as a default template parameter value. Don't choke on template parameters with erroneous default values.
2014-05-03 16:26:14 +02:00
Robert Reif
ca9386859b
Tokenizer: replace ') const| {' pattern to detect function start
2014-04-26 18:31:56 +02:00
Daniel Marjamäki
28751c8ad0
astyle formatting
...
[ci skip]
2014-04-15 06:32:25 +02:00
Alexander Mai
ac24635056
Convert MathLib::toLongNumber() from template member function to toLongNumber() and toULongNumber() to avoid various problems compiling with Visual Studio
2014-04-14 20:30:38 +02:00
Alexander Mai
718e42f5ca
Fix some clang warnings about type conversions
2014-04-11 23:35:53 +02:00
Alexander Mai
e19129a409
Fix #4724 (Error in calculation shift operation: wrong sign: 1UL << 63)
2014-04-10 19:22:14 +02:00
Daniel Marjamäki
5698f7b337
astyle formatting
2014-03-14 05:36:44 +01:00
Daniel Marjamäki
61eb262244
Fixed #5215 (segmentation fault (invalid code) in TemplateSimplifier::useDefaultArgumentValues)
2014-03-12 19:36:22 +01:00
Frank Zingsheim
b1dc51ba9c
Fixed #4796 (Missing semicolon after simplified template class)
2014-03-12 06:09:45 +01:00
Frank Zingsheim
5e0a575091
Optimization: tokenlist::addtoken
2014-03-09 17:54:49 +01:00
Simon Martin
3518e02d23
Ticket #5506 : Skip template parameters when determining whether a template is a declaration or a definition.
2014-03-01 14:58:47 +01:00
Daniel Marjamäki
23efc68dd7
use nullptr
2014-02-16 10:32:10 +01:00
Daniel Marjamäki
fd3a8a2a18
Update copyright
2014-02-15 07:45:39 +01:00
Graham Whitted
86201c13cb
Fixed #5097 (TemplateSimplifier::expandTemplate assertion failure)
2014-01-05 19:19:52 +01:00
PKEuS
621cf6e777
Support arrays as template parameters in TemplateSimplifier::templateParameters
2013-12-31 13:59:32 +01:00
Daniel Marjamäki
8cca41774d
Fixed #4446 (Crash on complex C++ template)
2013-11-21 20:27:24 +01:00
Daniel Marjamäki
f8cf64afef
Fixed #4710 (Template parser bug: const in constructor changes template names)
2013-11-19 06:07:25 +01:00
Daniel Marjamäki
1c513f330a
Fixed #5055 (False negatives when using -I (external source code))
2013-09-29 18:59:27 +02:00
Robert Reif
2de3ebcb1e
CheckIO: fixed some more false negatives. Ticket: #4964
2013-09-24 06:43:03 +02:00
Simon Martin
894f537eba
Remove warnings emitted by clang's -Wsign-conversion
2013-09-22 13:22:52 +02:00
Daniel Marjamäki
5d7518aa57
simplifyCalculations: Improved handling of casts ( #4899 )
2013-09-03 06:27:11 +02:00
Daniel Marjamäki
2a78db4c06
Refactoring Token::findClosingBracket.
2013-07-31 10:30:20 +02:00
Simon Martin
eb3bf571be
Avoid divisions by zero when simplifying numeric calculations.
2013-07-28 12:32:18 +02:00
Daniel Marjamäki
722bfe7197
Fixed #4553 (Wrong calculation of known values)
2013-06-14 18:51:52 +02:00
PKEuS
876e9c0039
Fixed issue on C++11 right angle brackets ( #4832 )
2013-06-12 13:43:29 -07:00
Frank Zingsheim
42068a3d60
Fixed #4767 (segmentation fault in expand template)
2013-05-01 13:28:01 +02:00
Daniel Marjamäki
c3d1274db3
Reverted 'simplify NOT' since there are problems related to signedness of numeric values.
2013-04-24 06:32:34 +02:00
Ettl Martin
cb343bd718
fixed typo in reporting Error
2013-04-16 11:25:45 +02:00
Daniel Marjamäki
9ad39ca4c0
Fixed #4544 (Crash with this line : class CD : public CC< class CB< CA > >)
2013-04-12 16:38:12 +02:00
Daniel Marjamäki
e8fbd39efd
Templates: better handling of 'X<class Y>' template instantiations. Ticket: #4544
2013-04-11 18:58:39 +02:00
Ettl Martin
33cfc1a52e
fixed #4726 : simplify bitwise Not (~ %num%)
2013-04-11 09:16:40 +02:00
Daniel Marjamäki
4abe1c0bac
Fix Cppcheck message
2013-04-07 19:33:46 +02:00
Daniel Marjamki
cd770fb106
Fixed #4310 (False positive 'boolean result in bitwise' message in template class (was #3818 ))
2013-04-07 16:48:42 +02:00
Daniel Marjamäki
369e80b021
Fixed #4465 (syntax error on valid C++ source file)
2013-03-14 18:52:22 +01:00
PKEuS
0105f8223c
Simplified several Token::Match/simpleMatch calls when match string consists of a single pattern
...
Fixed two CheckInternal error messages
2013-03-01 03:42:04 -08:00
PKEuS
f899e6ca30
Changed behaviour of %op% pattern accordingly to changes to Token::isOp(). Added %cop% as replacement for old %op%
2013-03-01 02:43:59 -08:00
PKEuS
670c4de8a9
Changed behaviour of Token::is*Op() functions:
...
- Rename Token::isOp() to Token::isConstOp() (indicating that the operator does _not_ modify the input variables)
- Create new Token::isOp(), returning true also for ++, -- and assignment operators
- Make Token::isExtendedOp() returning also true for all assignment and ++/-- operators
2013-02-28 12:50:29 -08:00
Daniel Marjamki
2a660fa3b4
Tokenizer: Fixed removeCast bug. Don't simplify (A)&b to A&b if A might be a type. Related with ticket: #4439
2013-02-16 16:58:36 +01:00