[clang] 6163b66 - [clang-repl] Another try on system-z.

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 20 01:23:59 PDT 2025


Author: Vassil Vassilev
Date: 2025-07-20T08:23:47Z
New Revision: 6163b66e0aa7a3fa32b05fa4e1016d0631c20451

URL: https://github.com/llvm/llvm-project/commit/6163b66e0aa7a3fa32b05fa4e1016d0631c20451
DIFF: https://github.com/llvm/llvm-project/commit/6163b66e0aa7a3fa32b05fa4e1016d0631c20451.diff

LOG: [clang-repl] Another try on system-z.

This patch should make msan happy as it found a real bug where we always try to
read an unsigned long long without respecting the underlying enum type.

Another follow-up on llvm/llvm-project#102858

Added: 
    

Modified: 
    clang/lib/Interpreter/InterpreterValuePrinter.cpp
    clang/test/Interpreter/pretty-print.cpp
    clang/unittests/Interpreter/InterpreterTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Interpreter/InterpreterValuePrinter.cpp b/clang/lib/Interpreter/InterpreterValuePrinter.cpp
index 34ffd62da85e4..0ea6274b79cba 100644
--- a/clang/lib/Interpreter/InterpreterValuePrinter.cpp
+++ b/clang/lib/Interpreter/InterpreterValuePrinter.cpp
@@ -106,7 +106,7 @@ static std::string EnumToString(const Value &V) {
   assert(EnumTy && "Fail to cast to enum type");
 
   EnumDecl *ED = EnumTy->getDecl();
-  uint64_t Data = V.getULongLong();
+  uint64_t Data = V.convertTo<uint64_t>();
   bool IsFirst = true;
   llvm::APSInt AP = Ctx.MakeIntValue(Data, DesugaredTy);
 

diff  --git a/clang/test/Interpreter/pretty-print.cpp b/clang/test/Interpreter/pretty-print.cpp
index 612c0bcfb720a..fd79d315e48ba 100644
--- a/clang/test/Interpreter/pretty-print.cpp
+++ b/clang/test/Interpreter/pretty-print.cpp
@@ -1,6 +1,6 @@
 // RUN: clang-repl "int i = 10;" 'extern "C" int printf(const char*,...);' \
 // RUN:            'auto r1 = printf("i = %d\n", i);' | FileCheck --check-prefix=CHECK-DRIVER %s
-// UNSUPPORTED: system-aix, system-zos, asan
+// UNSUPPORTED: system-aix
 // CHECK-DRIVER: i = 10
 // RUN: cat %s | clang-repl -Xcc -std=c++11 -Xcc -fno-delayed-template-parsing | FileCheck %s
 extern "C" int printf(const char*,...);

diff  --git a/clang/unittests/Interpreter/InterpreterTest.cpp b/clang/unittests/Interpreter/InterpreterTest.cpp
index fb9e98d134120..2ba15cbd37093 100644
--- a/clang/unittests/Interpreter/InterpreterTest.cpp
+++ b/clang/unittests/Interpreter/InterpreterTest.cpp
@@ -392,9 +392,6 @@ TEST_F(InterpreterTest, Value) {
   EXPECT_EQ(V9.getKind(), Value::K_PtrOrObj);
   EXPECT_TRUE(V9.isManuallyAlloc());
 
-  if (llvm::Triple(llvm::sys::getDefaultTargetTriple()).isSystemZ())
-    GTEST_SKIP(); // Enum printing is broken for unknown reasons on SystemZ.
-
   Value V10;
   llvm::cantFail(Interp->ParseAndExecute(
       "enum D : unsigned int {Zero = 0, One}; One", &V10));


        


More information about the cfe-commits mailing list