PKEuS
f78744ac30
Fixed AST generation if expression starts with ternary operator
2015-02-01 14:02:19 +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
orbitcowboy
5a8574cc05
tokenlist::createAst(); should not be const.
2015-01-20 11:22:22 +01:00
orbitcowboy
bf1565bd34
Fixed inconclusive warnings regarding const correctness.
2015-01-20 09:09:16 +01:00
Daniel Marjamäki
ff11ba9847
Updated copyright year to 2015
2015-01-03 12:14:58 +01:00
Alexander Mai
5300ba2074
Make single-argument constructors explicit
2014-11-13 21:39:14 +01:00
Daniel Marjamäki
7107286be6
Fixed #5891 (AST: wrong ast generated for 'x = (int)(double(123)*i);')
2014-10-16 15:57:05 +02:00
Daniel Marjamäki
94c677905b
ast: don't hang when invalid code with new is found 'new (var1,var2,var3);'
2014-10-13 19:12:20 +02:00
Daniel Marjamäki
aac9e66147
AST: fixed ast for 'new (char *)[10]'
2014-10-12 12:57:01 +02:00
Daniel Marjamäki
f72a8d3f15
AST: fixed ast for 'a(new A(1)), b(new B(2))'
2014-10-12 12:13:01 +02:00
Daniel Marjamäki
649e2dfa97
AST: fixed ast for 'a = new (b) ::X;'
2014-10-12 11:12:25 +02:00
Daniel Marjamäki
f96ea94048
AST: fixed ast for 'a(new (X), 5);'
2014-10-12 10:20:03 +02:00
Daniel Marjamäki
c537c98751
AST: fixed ast for 'a(new (X));'
2014-10-12 09:24:43 +02:00
Daniel Marjamäki
489fc6cce7
AST: more fixes of new statements in clang test suite. some of it is not handled very well.
2014-10-11 13:20:48 +02:00
Daniel Marjamäki
4783a67042
AST: fixes for more new statements from clang test suite
2014-10-11 11:27:13 +02:00
Daniel Marjamäki
e6708c1ae2
AST: fixed hang for 'new (int S::*[3][4][5])()' (clang test suite)
2014-10-11 08:32:49 +02:00
Daniel Marjamäki
5891bae59e
AST: generilized handling of auto usage in new statement
2014-10-10 19:05:31 +02:00
Daniel Marjamäki
66d4614a87
AST: don't hang when using auto in new statement
2014-10-10 12:47:01 +02:00
Daniel Marjamäki
b5faf3a0cc
AST: improved handling of new
2014-10-10 10:37:54 +02:00
Daniel Marjamäki
cca003490b
Fixed #6203 (AST: fix problem with '; static_cast<...')
2014-10-10 08:18:24 +02:00
Martin Ettl
2ca47601cd
Running astyle
2014-09-28 22:05:05 +02:00
Martin Ettl
b677d3d17f
Fix crash on garbage code in tokenlist. The corresponding backtrace along with a testcase is hosted at: https://github.com/orbitcowboy/cppcheck_crash_files/blob/master/crash220.cpp
2014-09-28 22:04:25 +02:00
PKEuS
58fe668fc4
Fixed AST for operator:: after template ( #6195 )
2014-09-29 11:01:37 +02:00
PKEuS
55b14853d0
Fixed AST: Compile expression inside [] brackets of operator new. ( #6193 )
2014-09-29 10:26:15 +02: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
Daniel Marjamäki
0ab7abded1
AST: fixed cast for 'return (long long)c << 40;'
2014-09-12 06:43:52 +02:00
PKEuS
e4a81f9666
Improved checksum algorithm to fix configurations being purged by coincidence ( #6126 ):
...
- Better distribution of values by rotating the bits of the checksum for each token
2014-09-03 23:10:38 +02:00
PKEuS
bf2f76e70c
Detect and purge duplicate configurations by calculating a checksum.
2014-09-02 22:35:52 +02:00
PKEuS
80df3dc642
Disabled several checks and simplifications for C code, if they are C++-only. Do not match arguments for C code, since there can't be overloads.
2014-09-01 18:43:24 +02:00
Daniel Marjamäki
cd75b2d83d
AST: fix hang for code 'MACRO({.x=1,.y=2})'
2014-08-25 19:10:16 +02:00
Daniel Marjamäki
1060b30e52
AST: better AST for placement new expression 'new (a) MyClass;'
2014-08-23 13:21:36 +02:00
PKEuS
a1b7ab277b
Changed handling of unhandled characters:
...
- Don't abort checking (reverts 42140b6488
)
- Modified error message: New Id unhandledCharacter, removed redundant line information, improved message text
2014-08-08 09:49:09 +02:00
PKEuS
95afa51b24
Fixed crash #5991 : Don't crash when lambda is incomplete
...
Fixed crash #6004 : Support struct initializations in AST
2014-07-31 23:15:36 +02:00
Dmitry-Me
ba3757dfd3
Bring variables decalaration to where they are really needed.
2014-07-10 11:23:14 +04:00
Alexander Mai
df95cd09f0
Fix compiler warnings about type mismatch
2014-07-08 21:47:22 +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
72992c7973
AST: fixed ast for '++i;'
2014-06-26 17:31:57 +02:00
PKEuS
7ea7ee0005
Store Token::_originalName on heap, since it is only used for a small amount of Tokens (reduce memory usage of TokenList by ~12% (x64))
2014-06-26 11:51:02 +02:00
PKEuS
ec1bd420a7
Refactorizations optimizing std::string usage:
...
1) Added global static const std::string emptyString; object:
-> Replaces some static variables in functions which might be not threadsafe
-> Avoids constructor call (std::string::string(""))
-> Even functions that return an empty string in some branches can return by reference now.
Added to config.h to ensure that it is available everywhere
2) Added overloads for TestFixture::assertEquals for the most common use cases:
-> Moves conversion from const char[] to std::string into a function, reducing code duplication in binary.
2014-06-26 11:51:02 +02:00
PKEuS
e80104327a
AST: Fixed detection of operator new/delete - don't hang when C code is checked as C++ ( #5910 )
2014-06-26 09:19:57 +02:00
PKEuS
3a89e5d65f
Fixed cppcheck warnings introduced by previous commit
2014-06-24 19:51:47 +02:00
PKEuS
1b5d127373
Cache results for TokenList::isC() and TokenList::isCPP() to avoid redundant calls to Path::isCPP()/isC(), which perform slow string operations (conversion to lowercase, substring, comparisons)
...
-> Speedup of 2% on self-checking cppcheck-core (MSVC12, x64, not matchcompiled)
2014-06-24 17:42:39 +02:00
PKEuS
8b9daadd25
Replaced static variable isCPP in Token (was not threadsafe):
...
- Encapsulate parameters passed through AST compiler functions in a struct
-> Reduces maintenance overhead when changing them
-> Contains parameter indicating if the file is C or C++
- Added eKeyword Token type (at the moment, only true for C++ keyword "delete", but should be set for other keywords as well)
2014-06-14 10:28:12 +02:00
PKEuS
2455b76abd
Fixed lots of bugs in the AST:
...
- Support new and delete
- Properly handle "..."
- References and rValue references as function parameters
- Destructor definitions
2014-06-04 18:47:56 +02:00
PKEuS
d93d7401c6
Moved getSourceFilePath(), isC() and isCPP() from Tokenizer to TokenList
...
Conflicts:
lib/tokenize.cpp
2014-06-04 18:36:25 +02:00
Daniel Marjamäki
46bf23aa6d
TokenList: added assertion that makes sure the Preprocessor doesn't let through extended ascii wrongly.
2014-05-31 18:02:19 +02:00
PKEuS
8f083af1e4
Attempt to fix travis build
2014-05-25 22:11:56 +02:00
PKEuS
a407b55945
Added support for lambdas to AST
...
Fixed bug that return statement left an operand on the stack
2014-05-25 21:55:39 +02:00
PKEuS
55c87248ba
Fixed crash on complex cast.
2014-05-24 20:21:08 +02:00
PKEuS
38aaa46804
Stabilized AST:
...
- Fixed broken simplification causing crashs when cast was followed by unary minus (real world examples from arch/parisc/math-emu/ (linux-kernel))
- Stabilized determination of unary and binary operators
2014-05-24 19:05:04 +02:00
PKEuS
b78131cfcf
Improved cast detection in AST:
...
-> Make use of it in checkother.cpp
Use tokenizer simplification instead of reimplementation for test suite
2014-05-24 11:29:32 +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
PKEuS
d1c4777053
Fixed two bugs in AST compilation ( #5830 ):
...
- Correctly parse operators .* and ->*
- Support empty branch in ternary expression (a?:c)
2014-05-19 21:54:59 +02:00
Philipp Kloke
ed7d0b321b
Bugfixes for AST and AST testing:
...
- Validate AST in test suite: Check for operand1 being set if operand2 is non-zero
- Fixed buggy unit tests in AST
- Fixed detection unary operator* after return statement (MPC-HC false positive)
2014-05-19 11:17:37 +02:00
PKEuS
683d0b7e82
Partially rewritten AST compilation:
...
- More straightforward approach for handling right-to-left associativity
- More straightforward approach to handling unary operators
- Improved handling of brackets
This fixes #5784 , #5795 , #5797 , #5799 , #5810 and a bunch of other problems
2014-05-18 12:10:39 +02:00
PKEuS
a3bb8bf39c
AST: Parse ternary and assignment operators as right-to-left and on the same precedence level
2014-05-11 17:50:58 +02:00
PKEuS
70dfb55f21
Simplified some Token::Match patterns
2014-05-11 17:50:58 +02:00
Daniel Marjamäki
9fc8bdcbac
Fixed #5770 (AST: better handling of 'a.b[c.d]==0')
2014-05-08 06:48:53 +02:00
Robert Reif
2d2847ddbd
Fixed #5764 (Store Token flags in a single variable)
2014-05-06 06:35:48 +02:00
Robert Reif
ae96491d6c
Fixed #5756 (declspec(nothrow) not supported)
2014-05-04 20:47:20 +02:00
Daniel Marjamäki
7d583e639c
AST: Fixed handling of '(((typeof(x))*)0)'
2014-05-04 18:36:04 +02:00
Daniel Marjamäki
5a23b739da
ValueFlow: Improved bailout when variable is reassigned
2014-05-03 12:49:07 +02:00
Daniel Marjamäki
4b7aaba159
AST: assignment operators are executed from right to left
2014-05-03 12:08:42 +02:00
Daniel Marjamäki
648479d909
AST: Fixed tree for 'a.b[5]'
2014-04-29 06:09:26 +02:00
Daniel Marjamäki
d279f3fb41
Fixed #5736 (AST: proper handling of 'a=(b).c;')
2014-04-27 18:03:50 +02:00
Daniel Marjamäki
9f2e37da37
AST: fixed 'a.b++' and '*c[5]--'
2014-04-27 16:02:24 +02:00
Daniel Marjamäki
11856b51aa
AST: Fixed handling of 'a=b(c**)+1'
2014-04-26 13:32:08 +02:00
Daniel Marjamäki
c34616a6ba
AST: Fixed handling of 'a = b.c[++(d.e)];'
2014-04-26 13:16:34 +02:00
Frank Zingsheim
ffa55bbaa0
Fixed #5725 (FP: multicondition Expression is always false because 'else if' in pngwrite.cxx (LibreOffice))
2014-04-26 11:59:38 +02:00
Daniel Marjamäki
8602d13dc9
Fixed #5722 (AST: wrong handling of 'x = ((a[i])->getx)();' - the 'x' is an operand of the =)
2014-04-25 06:06:54 +02:00
Daniel Marjamäki
c98beafb6d
Fixed #5675 (wrong AST generated for 'a>>=b')
2014-04-21 13:05:34 +02:00
Robert Reif
6ff5de2118
Fixed #5697 (Check for throw in __attribute__((nothrow)) function)
2014-04-20 20:40:55 +02:00
Daniel Marjamäki
5c116c622d
AST: Fixed iscast detection in '*((DWORD*)&buf[0])'
2014-04-15 15:46:26 +02:00
Daniel Marjamäki
4b6164087e
Use constant instead of magic number for AST recursion limit
...
[ci skip]
2014-04-15 06:31:09 +02:00
Daniel Marjamäki
cb830cb999
Code cleanup of stack depth tracking. Replaced class with simple POD variable.
2014-04-15 06:18:15 +02:00
Alexander Mai
40be775efa
#5592 (fix implementation detail to avoid warnings from cppcheck)
2014-04-13 13:08:38 +02:00
Alexander Mai
547803f581
#5592 - crash: gcc: testsuit: gcc.c-torture/compile/limits-declparen.c (Limit stack depth below createAst()
2014-04-13 12:47:54 +02:00
Daniel Marjamäki
456e33fc7b
Code cleanup
...
[ci skip]
2014-04-05 08:27:52 +02:00
Daniel Marjamäki
049d68ae7d
AST: Fixed bad syntax tree for 'if (x()[0]==1);'
2014-04-05 08:03:24 +02:00
PKEuS
e9411e05ba
Refactorized inefficient usage of std::string and const char[].
2014-04-02 13:56:34 +02:00
Daniel Marjamäki
484483bd5d
AST: fixed ast for 'for (*x=0;y;z)'
2014-03-31 17:16:13 +02:00
Robert Reif
8c993c1363
Partial fix for #5555 . Remember function attributes: pure, const, constructor, destructor
2014-03-14 05:40:17 +01:00
Frank Zingsheim
5e0a575091
Optimization: tokenlist::addtoken
2014-03-09 17:54:49 +01:00
Daniel Marjamäki
8550289722
Fixed #5452 (AST: wrong handling of unary ::)
2014-02-25 06:36:10 +01:00
Daniel Marjamäki
c050a92bae
Fixed #5468 (crash: freebsd: llvm/RegionPrinter.cpp - AST failure)
2014-02-17 17:37:39 +01:00
Lauri Nurmi
70a67eaf85
Change some more 0 literals into nullptr.
2014-02-16 13:38:50 +02:00
Daniel Marjamäki
fd3a8a2a18
Update copyright
2014-02-15 07:45:39 +01:00
Daniel Marjamäki
a1d9873558
Fixed #5465 (crash: AST doesnt produce good output for 'class C:public : 🅰️ :b<c>{..};')
2014-02-14 06:30:51 +01:00
Daniel Marjamäki
6ac9e180e0
ast: fixed hang when checking beid
2014-02-05 06:05:48 +01:00
Daniel Marjamäki
2ed3b40937
ast: fixed hang when checking bin-prot
2014-02-04 19:33:26 +01:00
Daniel Marjamäki
d6e3b3d3f3
ast: fixed syntax tree for 'a=(b)?1:0'. The parentheses should not be in the syntax tree
2014-01-30 17:31:06 +01:00
Lucas Manuel Rodriguez
b69fedf70b
Fix '-Wshadow' warning (from 'Fixed #5423 ' commit)
2014-01-28 23:16:29 -03:00
Kamil Dudka
dee18d10a8
Fixed #5423 (fix parsing of #line NNNN "file.c")
2014-01-28 17:15:07 +01:00
Daniel Marjamäki
2108251851
Fixed #5417 (ast: avoid hang when '({})' is used)
2014-01-28 06:11:53 +01:00
Daniel Marjamäki
c8a1424e10
Fixed #5406 (crash inside valueFlowBeforeCondition() on files from kernel-git)
2014-01-27 06:18:42 +01:00
Daniel Marjamäki
ec034c1d59
Fixed #5386 (ast: hang when code is 'for (T a : b)')
2014-01-23 06:13:24 +01:00
Daniel Marjamäki
6a3a9ee8e7
ast: fixed tree for 'sizeof(struct S)'
2014-01-18 13:18:11 +01:00
Daniel Marjamäki
85b73f7c24
ast: fixed hang for weird loop: 'for (each_window(list,p))'
2014-01-16 16:58:50 +01:00
Daniel Marjamäki
e72ec830ef
ast: fixed hang in for-loop handling
2014-01-16 06:45:35 +01:00