Commit Graph

9867 Commits

Author SHA1 Message Date
Paul Fultz II 8b27f1c216
Fix issue 9667: crash: crash in valueflow for weird code where label address is returned (#2602) 2020-04-11 13:56:53 +02:00
Daniel Marjamäki e8e3c2660d Detect syntax error 'x ==> y' 2020-04-11 11:05:27 +02:00
Daniel Marjamäki c029d5150c Fixed #9123 (False positive: uninitialized variable) 2020-04-10 12:33:15 +02:00
Daniel Marjamäki 0725c2290c Tokenizer: Do not simplify function pointers to normal pointers as we loose important information 2020-04-10 11:53:32 +02:00
Daniel Marjamäki e0c8118c02 Fixed crash in AST 2020-04-09 17:42:51 +02:00
Daniel Marjamäki 8e9d7290b2 Tokenizer::simplifyTypedef: Better handling of r-value references 2020-04-08 22:40:45 +02:00
Daniel Marjamäki 37a4e375ba astyle formatting
[ci skip]
2020-04-08 22:39:17 +02:00
Achouv 7719e4309d
avoid false positive unused static const struct member (#2598) 2020-04-08 18:09:20 +02:00
Paul Fultz II 3773d0e875
Find more redundant conditions (#2597) 2020-04-07 07:15:15 +02:00
Daniel Marjamäki 66ee3a0afc Clang import: Better handling of methods that are defined after declaration 2020-04-06 17:18:52 +02:00
Paul Fultz II 8fd0839fea
Add regression test for 9534: False positive: Returning pointer to local variable 'x' that will be invalid when returning. (#2596) 2020-04-06 16:02:10 +02:00
Daniel Marjamäki 8dd0a9241c TemplateSimplifier: Simplification of const types 2020-04-05 13:51:58 +02:00
Daniel Marjamäki f01783238e Fixed #9596 (False positive: Returning an integer in a function with a pointer return type auto handling) 2020-04-04 20:03:48 +02:00
Paul Fultz II efdc5f5c4e
Fix issue 9435: False negative: invalidContainer when using range for loop (#2587)
* Fix issue 9435: False negative: invalidContainer when using range for loop

* Use ast

* Make string const
2020-04-04 11:47:02 +02:00
Oliver Stöneberg 1dd8d4afaf
fixes for Clang and clang-tidy 10 (#2588)
* clang_tidy.cmake: added clang-tidy-10 to program list

* fixed -Wrange-loop-construct Clang warnings

* fixed readability-qualified-auto clang-tidy warnings

* .clang-tidy: actually disable clang-analyzer-* warnings

* .clang-tidy: disabled some new warnings introduced with clang-tidy-10
2020-04-04 11:44:59 +02:00
Paul Fultz II 40e1e82a65
Fix issue 9644: Token::astOperand1() cyclic dependency on valid C++ code (#2590)
* Remove check for lambda

* Add test case
2020-04-04 10:55:31 +02:00
Daniel Marjamäki e0acd1abf8 Tokenizer: Report unknown macro that contains '.x=..' argument 2020-04-04 10:32:56 +02:00
Paul Fultz II 58e3f19ed8
Fix issue 9662: AST broken, ternary operator missing operand(s) on valid C++ code (#2589)
* Fix issue 9662: AST broken, ternary operator missing operand(s) on valid C++ code

* Add test for issue 9537
2020-04-03 10:04:10 +02:00
Paul Fultz II 71deaaeb18
Fix issue 9608: False Positive: returnDanglingLifetime with braced-init-list (#2583) 2020-04-02 10:17:58 +02:00
Paul Fultz II 02ae71917a
Fix issue 9536: False positive: Reference to temporary returned when using operator() (#2582)
* Fix issue 9536: False positive: Reference to temporary returned when using operator()

* Add more test cases
2020-04-01 22:35:41 +02:00
Paul Fultz II 6cc58e1086
Set a max for the combination of arguments that can be passsed through valueFlowSubFunction (#2579)
* Set a max for the combination of arguments that can be passsed

* Skip mismatch path ids when computing the cross product
2020-04-01 22:33:09 +02:00
Dmitry-Me b51e4dfeea Improved test to have all lines reached 2020-03-27 19:11:38 +03:00
Dmitry-Me e1d38a854b Improved test to have all lines reached 2020-03-25 18:11:05 +03:00
Paul Fultz II 5462e43161
Fix issue 9639: False positive: Returning object that points to local variable that will be invalid when returning (#2576)
* Follow reference when tracking local variables

* Fix issue 9639: False positive: Returning object that points to local variable that will be invalid when returning
2020-03-23 22:54:53 +01:00
Paul Fultz II b68d6f9471
Fix crash in valueflow when using local classes (#2575) 2020-03-22 10:12:53 +01:00
Paul Fultz II 7fd3580f21
Dont traverse conditions multiple times (#2574) 2020-03-20 10:37:16 +01:00
Paul Fultz II f2527f5340
Fix crash in valueFlowForLoopSimplifyAfter (#2573) 2020-03-20 07:16:05 +01:00
Daniel Marjamäki 1173186876 Fixed daca@home crash by stopping for unknown macro 'MACRO(a();b();)' 2020-03-12 13:28:09 +01:00
Daniel Marjamäki 900b99fbd8 Tokenizer; Report unknown macro used in function declaration 2020-03-10 20:22:46 +01:00
Sebastian b8432b7e23
testsymboldatabase.cpp: Fix AppVeyor build error (#2568) 2020-03-10 12:26:00 +01:00
Daniel Marjamäki f093d23a36 SymbolDatabase: Fixed addArguments 2020-03-09 15:13:50 +01:00
Daniel Marjamäki 1008868506 AST: Better handling of '(type){..}' 2020-03-08 16:46:06 +01:00
Daniel Marjamäki cdee62c032 AST: Fixed AST for struct cast '(struct T){...}' 2020-03-08 16:21:22 +01:00
Daniel Marjamäki 5ea01c5d60 Fix Cppcheck warning 2020-03-08 10:02:46 +01:00
Daniel Marjamäki 5376ba1701 AST: Throw validation exception if ternary operator is missing operands 2020-03-07 21:46:38 +01:00
amai2012 b795d30db6 Enable another zeroDivCond test which got fixed recently 2020-03-06 17:15:54 +01:00
orbitcowboy f05c504440 Running astyle [ci skip] 2020-03-03 20:38:30 +01:00
Dmitry-Me b61feff125 Improve test coverage for detecting invalid pointers 2020-03-02 19:01:27 +03:00
Paul Fultz II 6ea4f60600
Enable valueFlowSubfunction for multiple parameters (#2550) 2020-03-01 16:46:20 +01:00
Daniel Marjamäki 5df6d5bc7c Tokenizer; Warn about unknown macro used in string concatenation 2020-02-28 21:52:01 +01:00
Sebastian f0e3f9e79a
gtk.cfg: Fix/enhance Gtk library configuration (g_abort and others) (#2558)
test/CMakeLists.txt: Fix missing INCONCLUSIVE for Gtk configuration test
2020-02-27 13:16:43 +01:00
Daniel Marjamäki 38b570138f AST: Try to handle c++17 for properly 'for (auto [a,b]:c)' 2020-02-27 09:58:53 +01:00
Daniel Marjamäki 84995485ea VarId: fixed varids for 'for (auto [x,y]: xy)' 2020-02-27 07:18:07 +01:00
orbitcowboy a5ca3cb1f0 wxwidgets.cfg: Fixed FP for wxSizer::Add() 2020-02-26 16:10:10 +01:00
Sebastian 8fd17546ad
qt.cfg: #9650: Fix missing configuration for QString.chop() (#2556)
chop() and also remove() change the size of a QString, so they have to
be added in the container configuration accordingly to avoid false
positives.
2020-02-26 10:53:03 +01:00
Sebastian fb36889d29
gtk.cfg: Fix syntax errors and false positives (#2552)
A missing definition for g_assert_cmp*() causes syntax errors if code
like g_assert_cmpint(a, ==, b); is encountered.
The function g_hash_table_iter_replace() does not have to be marked
with leak-ignore since the memory could be freed later if corresponding
functions are present in the GHashTable. Since we can not know if this
is the case we have to assume that the memory is freed to avoid false
positives. The same is true for g_hash_table_insert() and
g_hash_table_replace().
2020-02-26 10:33:23 +01:00
orbitcowboy b32a89924c wxwidgets.cfg: Added <not-bool/>-flag at more function args. 2020-02-25 21:48:15 +01:00
Daniel Marjamäki e4937ed621 AST: Fixed wrong AST for cast '(std::vector<int>&&)s->second' 2020-02-25 21:05:49 +01:00
orbitcowboy e9937e3acb wxwidgets.cfg: Fixed recently introduced FP. 2020-02-25 20:23:20 +01:00
Rikard Falkeborn 9896dce7f2
checkuninitvar: Fix FN with c++ casts (#2549) 2020-02-23 19:53:17 +01:00