ExprEngine: Handle char literals
This commit is contained in:
parent
3b3ff2bb62
commit
0471e74489
|
@ -747,7 +747,7 @@ static ExprEngine::ValuePtr executeExpression(const Token *tok, Data &data)
|
|||
if (tok->isName() && tok->hasKnownIntValue())
|
||||
return executeKnownMacro(tok, data);
|
||||
|
||||
if (tok->isNumber())
|
||||
if (tok->isNumber() || tok->tokType() == Token::Type::eChar)
|
||||
return executeNumber(tok);
|
||||
|
||||
if (tok->tokType() == Token::Type::eString)
|
||||
|
|
|
@ -61,7 +61,8 @@ private:
|
|||
|
||||
TEST_CASE(localArray1);
|
||||
TEST_CASE(localArray2);
|
||||
TEST_CASE(localArray3);
|
||||
TEST_CASE(localArrayInit1);
|
||||
TEST_CASE(localArrayInit2);
|
||||
TEST_CASE(localArrayUninit);
|
||||
|
||||
TEST_CASE(pointerAlias1);
|
||||
|
@ -193,11 +194,15 @@ private:
|
|||
}
|
||||
|
||||
void localArray2() {
|
||||
ASSERT_EQUALS("0:255", getRange("int f() { unsigned char arr[10] = \"\"; dostuff(arr); return arr[4]; }", "arr[4]"));
|
||||
}
|
||||
|
||||
void localArrayInit1() {
|
||||
ASSERT_EQUALS("0", getRange("inf f() { char arr[10] = \"\"; return arr[4]; }", "arr[4]"));
|
||||
}
|
||||
|
||||
void localArray3() {
|
||||
ASSERT_EQUALS("0:255", getRange("int f() { unsigned char arr[10] = \"\"; dostuff(arr); return arr[4]; }", "arr[4]"));
|
||||
void localArrayInit2() {
|
||||
ASSERT_EQUALS("66", getRange("void f() { char str[] = \"hello\"; str[0] = \'B\'; }", "str[0]=\'B\'"));
|
||||
}
|
||||
|
||||
void localArrayUninit() {
|
||||
|
|
Loading…
Reference in New Issue