Revert "Fix crash with garbage code (#2547)"
This reverts commit b25709a492
.
The real problem was wrong AST for valid code, I want to fix that instead.
This commit is contained in:
parent
b25709a492
commit
26a11e20d0
|
@ -68,7 +68,7 @@ struct ForwardTraversal {
|
||||||
|
|
||||||
template<class T, class F, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*>)>
|
template<class T, class F, REQUIRES("T must be a Token class", std::is_convertible<T*, const Token*>)>
|
||||||
Progress traverseConditional(T* tok, F f, bool traverseUnknown) {
|
Progress traverseConditional(T* tok, F f, bool traverseUnknown) {
|
||||||
if (Token::Match(tok, "?|&&|%oror%") && tok->astOperand1() && tok->astOperand2()) {
|
if (Token::Match(tok, "?|&&|%oror%")) {
|
||||||
T* condTok = tok->astOperand1();
|
T* condTok = tok->astOperand1();
|
||||||
if (traverseRecursive(condTok, f, traverseUnknown) == Progress::Break)
|
if (traverseRecursive(condTok, f, traverseUnknown) == Progress::Break)
|
||||||
return Progress::Break;
|
return Progress::Break;
|
||||||
|
|
|
@ -245,7 +245,6 @@ private:
|
||||||
TEST_CASE(garbageCode211); // #8764
|
TEST_CASE(garbageCode211); // #8764
|
||||||
TEST_CASE(garbageCode212); // #8765
|
TEST_CASE(garbageCode212); // #8765
|
||||||
TEST_CASE(garbageCode213); // #8758
|
TEST_CASE(garbageCode213); // #8758
|
||||||
TEST_CASE(garbageCode214);
|
|
||||||
|
|
||||||
TEST_CASE(garbageCodeFuzzerClientMode1); // test cases created with the fuzzer client, mode 1
|
TEST_CASE(garbageCodeFuzzerClientMode1); // test cases created with the fuzzer client, mode 1
|
||||||
|
|
||||||
|
@ -1667,17 +1666,6 @@ private:
|
||||||
ASSERT_THROW(checkCode("{\"\"[(1||)];}"), InternalError);
|
ASSERT_THROW(checkCode("{\"\"[(1||)];}"), InternalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void garbageCode214() {
|
|
||||||
checkCode("void\n"
|
|
||||||
"f(a, b, h)\n"
|
|
||||||
"struct g *a; {\n"
|
|
||||||
" long e;\n"
|
|
||||||
" if (e) {\n"
|
|
||||||
" (void) d((long) !b, c ? FALSE : TRUE);\n"
|
|
||||||
" }\n"
|
|
||||||
"}\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void syntaxErrorFirstToken() {
|
void syntaxErrorFirstToken() {
|
||||||
ASSERT_THROW(checkCode("&operator(){[]};"), InternalError); // #7818
|
ASSERT_THROW(checkCode("&operator(){[]};"), InternalError); // #7818
|
||||||
ASSERT_THROW(checkCode("*(*const<> (size_t); foo) { } *(*const (size_t)() ; foo) { }"), InternalError); // #6858
|
ASSERT_THROW(checkCode("*(*const<> (size_t); foo) { } *(*const (size_t)() ; foo) { }"), InternalError); // #6858
|
||||||
|
|
Loading…
Reference in New Issue