cppcheck/test
Daniel Marjamäki f5fe5ca2dd
9768: Fix ast with throw in the middle of return (#2678)
* 9768: Fix ast with throw in the middle of return

```
int f(bool x)
{
    return x ? 0 : throw 0;
}
```

The `throw` part was not included in the ast, leading to an invalid
ternary operator.

* 8526: Fix ast construction for ternary operator

This tries to decide a bit more properly when ':' can be part of a
ternary operator. More precisely, there are some times when we want to
delay the construction of the ast for ':', so that it is place
accordingly to the matching '?'.

Typically, this fixes an issue with
`return val < 0 ? throw 1 : val;`,
where the ast for ':' would be constructed during as part of the
`throw`, and the ast for `?` would be invalid.

This patch is a bit of a hardcode, stating that we don't expect ':'
inside a throw, unless there is a complete ternary operator in there
(there can't be a range based for loop, a case in a switch). When we
reach ':', we know we are and the end of the `throw`.
2020-06-15 10:36:02 +02:00
..
bug-hunting
cfg
cli
synthetic
testsuites
CMakeLists.txt
options.cpp
options.h
precompiled.h
redirect.h
test.cxx
test64bit.cpp
testassert.cpp
testastutils.cpp
testautovariables.cpp
testbool.cpp
testboost.cpp
testbufferoverrun.cpp
testcharvar.cpp
testclangimport.cpp
testclass.cpp
testcmdlineparser.cpp
testcondition.cpp
testconstructors.cpp
testcppcheck.cpp
testerrorlogger.cpp
testexceptionsafety.cpp
testexprengine.cpp
testfilelister.cpp
testfunctions.cpp
testgarbage.cpp
testimportproject.cpp
testincompletestatement.cpp
testinternal.cpp
testio.cpp
testleakautovar.cpp
testlibrary.cpp Update copyright year 2020-06-13 16:37:12 +02:00
testmathlib.cpp
testmemleak.cpp
testnullpointer.cpp
testoptions.cpp
testother.cpp
testpath.cpp
testpathmatch.cpp
testplatform.cpp
testpostfixoperator.cpp
testpreprocessor.cpp
testrunner.cpp
testrunner.vcxproj Visual Studio: Use new files precompiled.h with several common includes for core and testrunner. 2020-05-29 12:16:04 +02:00
testrunner.vcxproj.filters
testsamples.cpp
testsimplifytemplate.cpp
testsimplifytokens.cpp
testsimplifytypedef.cpp
testsimplifyusing.cpp
testsizeof.cpp
teststl.cpp
teststring.cpp
testsuite.cpp
testsuite.h
testsuppressions.cpp
testsymboldatabase.cpp
testthreadexecutor.cpp
testtimer.cpp
testtoken.cpp
testtokenize.cpp
testtokenlist.cpp
testtype.cpp
testuninitvar.cpp
testunusedfunctions.cpp
testunusedprivfunc.cpp
testunusedvar.cpp
testutils.cpp
testutils.h
testvaarg.cpp
testvalueflow.cpp
testvarid.cpp