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