diff options
author | Stefan Gränitz <stefan.graenitz@gmail.com> | 2024-03-25 09:42:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-25 09:42:41 +0100 |
commit | aa962d67ee896f416e285a9298e45fc08ff95eef (patch) | |
tree | e00b7223834fb2a87d68cff2eb2eca1c6470d740 /clang/unittests/Interpreter/InterpreterTest.cpp | |
parent | fa3d789df15bd1f58fb8ba4ea3be909218cf7f03 (diff) | |
download | llvm-aa962d67ee896f416e285a9298e45fc08ff95eef.zip llvm-aa962d67ee896f416e285a9298e45fc08ff95eef.tar.gz llvm-aa962d67ee896f416e285a9298e45fc08ff95eef.tar.bz2 |
[clang-repl] Fix Value for platforms where unqualified char is unsigned (#86118)
Signedness of unqualified `char` is unspecified and varies between
platforms. This patch adds `Char_U` in `REPL_BUILTIN_TYPES` to account
for platforms that default to `unsigned char`.
Diffstat (limited to 'clang/unittests/Interpreter/InterpreterTest.cpp')
-rw-r--r-- | clang/unittests/Interpreter/InterpreterTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/Interpreter/InterpreterTest.cpp b/clang/unittests/Interpreter/InterpreterTest.cpp index e76c067..69bc2da 100644 --- a/clang/unittests/Interpreter/InterpreterTest.cpp +++ b/clang/unittests/Interpreter/InterpreterTest.cpp @@ -340,6 +340,12 @@ TEST(InterpreterTest, Value) { EXPECT_EQ(V1.getKind(), Value::K_Int); EXPECT_FALSE(V1.isManuallyAlloc()); + Value V1b; + llvm::cantFail(Interp->ParseAndExecute("char c = 42;")); + llvm::cantFail(Interp->ParseAndExecute("c", &V1b)); + EXPECT_TRUE(V1b.getKind() == Value::K_Char_S || + V1b.getKind() == Value::K_Char_U); + Value V2; llvm::cantFail(Interp->ParseAndExecute("double y = 3.14;")); llvm::cantFail(Interp->ParseAndExecute("y", &V2)); |