fix daca crash in intel-compute-runtime (#3132)
This commit is contained in:
parent
e219596797
commit
7ab84bef0c
|
@ -2308,7 +2308,7 @@ bool Tokenizer::simplifyUsing()
|
||||||
const ScopeInfo3 * memberFuncScope = nullptr;
|
const ScopeInfo3 * memberFuncScope = nullptr;
|
||||||
const Token * memberFuncEnd = nullptr;
|
const Token * memberFuncEnd = nullptr;
|
||||||
bool skip = false; // don't erase type aliases we can't parse
|
bool skip = false; // don't erase type aliases we can't parse
|
||||||
for (Token* tok1 = startToken; tok1 != endToken; tok1 = tok1->next()) {
|
for (Token* tok1 = startToken; tok1 && tok1 != endToken; tok1 = tok1->next()) {
|
||||||
if ((Token::Match(tok1, "{|}|namespace|class|struct|union") && tok1->strAt(-1) != "using") ||
|
if ((Token::Match(tok1, "{|}|namespace|class|struct|union") && tok1->strAt(-1) != "using") ||
|
||||||
Token::Match(tok1, "using namespace %name% ;|::")) {
|
Token::Match(tok1, "using namespace %name% ;|::")) {
|
||||||
setScopeInfo(tok1, ¤tScope1);
|
setScopeInfo(tok1, ¤tScope1);
|
||||||
|
|
|
@ -64,6 +64,7 @@ private:
|
||||||
TEST_CASE(simplifyUsing15);
|
TEST_CASE(simplifyUsing15);
|
||||||
TEST_CASE(simplifyUsing16);
|
TEST_CASE(simplifyUsing16);
|
||||||
TEST_CASE(simplifyUsing17);
|
TEST_CASE(simplifyUsing17);
|
||||||
|
TEST_CASE(simplifyUsing18);
|
||||||
|
|
||||||
TEST_CASE(simplifyUsing8970);
|
TEST_CASE(simplifyUsing8970);
|
||||||
TEST_CASE(simplifyUsing8971);
|
TEST_CASE(simplifyUsing8971);
|
||||||
|
@ -457,6 +458,11 @@ private:
|
||||||
ASSERT_EQUALS(expected, tok(code, false));
|
ASSERT_EQUALS(expected, tok(code, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void simplifyUsing18() {
|
||||||
|
const char code[] = "{ { { using a = a; using a; } } }";
|
||||||
|
tok(code, false); // don't crash
|
||||||
|
}
|
||||||
|
|
||||||
void simplifyUsing8970() {
|
void simplifyUsing8970() {
|
||||||
const char code[] = "using V = std::vector<int>;\n"
|
const char code[] = "using V = std::vector<int>;\n"
|
||||||
"struct A {\n"
|
"struct A {\n"
|
||||||
|
|
Loading…
Reference in New Issue