From c1e2c0873678dca1e20d2638936038dea2b78975 Mon Sep 17 00:00:00 2001 From: Devajith Valaparambil Sreeramaswamy Date: Wed, 1 Oct 2025 14:23:38 +0200 Subject: [PATCH 1/3] [cling][test] Remove `std::string s(u8"UTF8")` as it is ill-formed in C++20 Ref: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1423r0.html --- interpreter/cling/test/Prompt/ValuePrinter/Strings.C | 3 --- 1 file changed, 3 deletions(-) diff --git a/interpreter/cling/test/Prompt/ValuePrinter/Strings.C b/interpreter/cling/test/Prompt/ValuePrinter/Strings.C index 82d57dc8f388c..47256d9f1fce5 100644 --- a/interpreter/cling/test/Prompt/ValuePrinter/Strings.C +++ b/interpreter/cling/test/Prompt/ValuePrinter/Strings.C @@ -115,9 +115,6 @@ cling::printValue(&RawData)[13] "\xed\xaf\xbf\xed\xbf\xbf" // CHECK-NEXT: (const char[7]) "\xed\xaf\xbf\xed\xbf\xbf" -std::string(u8"UTF-8") -// CHECK-NEXT: (std::string) "UTF-8" - std::u16string(u"UTF-16 " u"\x394" u"\x3a6" u"\x3a9") // CHECK-NEXT: (std::u16string) u"UTF-16 ΔΦΩ" From fa506e905d5af1d158631f62e7f7484b0bb7c2c6 Mon Sep 17 00:00:00 2001 From: Devajith Valaparambil Sreeramaswamy Date: Wed, 1 Oct 2025 18:23:54 +0200 Subject: [PATCH 2/3] [cling][test] Avoid resolving from system headers in SymbolResolverCallback This will fix the failing tests - Extensions/Lookup/Simple.C - Extensions/Lookup/SimpleDynamicExprs.C That were failing with the following error: ``` In file included from ...include/cling/Interpreter/RuntimePrintValue.h:20: In file included from /usr/include/c++/13/filesystem:49: 1: /usr/include/c++/13/bits/fs_path.h:1433:30: error: called object type 'TestProxy *' is not a function or function pointer 1: { return __path_iter_distance(__first, __last); } 1: ~~~~~~~~~~~~~~~~~~~~^ ``` --- interpreter/cling/lib/Interpreter/InterpreterCallbacks.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/interpreter/cling/lib/Interpreter/InterpreterCallbacks.cpp b/interpreter/cling/lib/Interpreter/InterpreterCallbacks.cpp index e17e841a3e9e4..e82aa150f1d40 100644 --- a/interpreter/cling/lib/Interpreter/InterpreterCallbacks.cpp +++ b/interpreter/cling/lib/Interpreter/InterpreterCallbacks.cpp @@ -423,8 +423,13 @@ namespace test { return false; // Only for demo resolve all unknown objects to cling::test::Tester + // but skip unresolved names coming from system headers, + // like __path_iter_distance from + clang::Sema& SemaR = m_Interpreter->getSema(); + clang::SourceManager& SM = SemaR.getSourceManager(); + if (SM.isInSystemHeader(R.getNameLoc())) + return false; if (!m_TesterDecl) { - clang::Sema& SemaR = m_Interpreter->getSema(); clang::NamespaceDecl* NSD = utils::Lookup::Namespace(&SemaR, "cling"); NSD = utils::Lookup::Namespace(&SemaR, "test", NSD); m_TesterDecl = utils::Lookup::Named(&SemaR, "Tester", NSD); From de499bf7deff5e01664809967a7dcdb845fe294f Mon Sep 17 00:00:00 2001 From: Devajith Valaparambil Sreeramaswamy Date: Thu, 2 Oct 2025 10:34:40 +0200 Subject: [PATCH 3/3] [cling][test] Fix SourceLocation test for C++20 --- .../test/Prompt/ValuePrinter/SourceLocation.C | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/interpreter/cling/test/Prompt/ValuePrinter/SourceLocation.C b/interpreter/cling/test/Prompt/ValuePrinter/SourceLocation.C index ba4016449be89..6f948bea949ea 100644 --- a/interpreter/cling/test/Prompt/ValuePrinter/SourceLocation.C +++ b/interpreter/cling/test/Prompt/ValuePrinter/SourceLocation.C @@ -8,22 +8,27 @@ //------------------------------------------------------------------------------ // RUN: cat %s | %cling | FileCheck %s +.rawInput 1 #include #if __cplusplus >= 202002L #include #endif -#ifndef __cpp_lib_source_location -// Hack to prevent failure if __cpp_lib_source_location feature does not exist! -std::cout << "(std::source_location) "; -std::cout << "CHECK_SRCLOC:42:std::source_location getsrcloc()\n"; -#else +#ifdef __cpp_lib_source_location #include std::source_location getsrcloc() { #line 42 "CHECK_SRCLOC" return std::source_location::current(); } -getsrcloc() +#else +// Hack to prevent failure if __cpp_lib_source_location feature does not exist! +void getsrcloc() { + std::cout << "(std::source_location) "; + std::cout << "CHECK_SRCLOC:42:std::source_location getsrcloc()\n"; +} #endif +.rawInput 0 + +getsrcloc() // CHECK: (std::source_location) // CHECK: CHECK_SRCLOC:42:std::source_location getsrcloc()