Skip to content

Commit

Permalink
Move around
Browse files Browse the repository at this point in the history
  • Loading branch information
olabetskyi committed Jul 11, 2024
1 parent 9ac1525 commit 482309a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7422,7 +7422,7 @@ void SymbolDatabase::setValueTypeInTokenList(bool reportDebugWarnings, Token *to
} else if (tok->isLong()) {
valuetype.originalTypeName = "wchar_t";
valuetype.type = ValueType::Type::WCHAR_T;
} else if ((tok->tokType() == Token::eChar) && ((!tok->isCpp() && tok->isCChar()) || (tok->isCMultiChar() && !isPrefixStringCharLiteral(tok->str(), '\'', "\'\\")))) {
} else if ((tok->tokType() == Token::eChar) && ((!tok->isCpp() && tok->isCChar()) || (tok->isCMultiChar()))) {
valuetype.type = ValueType::Type::INT;
valuetype.sign = ValueType::Sign::SIGNED;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/token.h
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ class CPPCHECKLIB Token {
}

bool isCMultiChar() const {
return (((mTokType == eChar) && isPrefixStringCharLiteral(mStr, '\'', emptyString)) &&
return (((mTokType == eChar) && isPrefixStringCharLiteral(mStr, '\'', emptyString)) && !isPrefixStringCharLiteral(mStr, '\'', "\'\\") &&
(mStr.length() > 3));
}
/**
Expand Down
8 changes: 8 additions & 0 deletions test/testtoken.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,14 @@ class TestToken : public TestFixture {
ASSERT_EQUALS(false, tok.isUtf32());
ASSERT_EQUALS(false, tok.isLong());
ASSERT_EQUALS(true, tok.isCMultiChar());

tok.str("'\''");
ASSERT_EQUALS(true, tok.isCChar());
ASSERT_EQUALS(false, tok.isUtf8());
ASSERT_EQUALS(false, tok.isUtf16());
ASSERT_EQUALS(false, tok.isUtf32());
ASSERT_EQUALS(false, tok.isLong());
ASSERT_EQUALS(false, tok.isCMultiChar());
}

void stringTypes() const {
Expand Down

0 comments on commit 482309a

Please sign in to comment.