Fixed crash in clang test suite introduced by previous commit.

This commit is contained in:
PKEuS 2015-11-02 22:52:27 +01:00
parent b049050792
commit b97f9e576d
2 changed files with 8 additions and 2 deletions

View File

@ -9294,7 +9294,7 @@ void Tokenizer::simplifyAsm2()
for (Token *tok = list.front(); tok; tok = tok->next()) {
if (Token::simpleMatch(tok, "^ {")) {
Token * start = tok;
while (start && !Token::Match(start, "[;{})]")) {
while (start && !Token::Match(start, "[;{})=]")) {
start = start->previous();
}
if (start)
@ -9304,7 +9304,8 @@ void Tokenizer::simplifyAsm2()
last = last->next();
while (last && !Token::Match(last->next(), "[;{})]"))
last = last->next();
last = last->next();
if (last)
last = last->next();
}
if (start && last) {
std::string asmcode(start->str());

View File

@ -789,6 +789,11 @@ private:
" return sizeof...(args);\n"
" }();\n"
"};"));
ASSERT_EQUALS("int ( ^ block ) ( void ) = asm ( \"^{staticinttest=0;returntest;}\" ) ;",
tokenizeAndStringify("int(^block)(void) = ^{\n"
" static int test = 0;\n"
" return test;\n"
"};"));
}
// #3503 - don't "simplify" SetFunction member function to a variable