[clang] [clang-tools-extra] [compiler-rt] [lldb] [llvm] [mlir] [openmp] [polly] fix(python): fix comparison to None (PR #91857)

2024-05-17 Thread Maksim Levental via cfe-commits

https://github.com/makslevental approved this pull request.

There you go - diligently reviewed using GitHub 's fantastic UI.

![Screenshot_20240517_011154_com android 
chrome](https://github.com/llvm/llvm-project/assets/5657668/ece87aff-4c44-4f07-8176-1adeaa4ff32e)


https://github.com/llvm/llvm-project/pull/91857
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang-tools-extra] [compiler-rt] [lldb] [llvm] [mlir] [openmp] [polly] fix(python): fix comparison to None (PR #91857)

2024-05-17 Thread Maksim Levental via cfe-commits

makslevental wrote:

It's a `sed s/== None/is None/g` - what is there to review? 10 separate PRs for 
the same exact `sed` costs more in commit noise (and effort on the part of 
@e-kwsm) than one solid, patient, review here.

https://github.com/llvm/llvm-project/pull/91857
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-11-02 Thread Maksim Levental via cfe-commits

https://github.com/makslevental closed 
https://github.com/llvm/llvm-project/pull/69072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-20 Thread Maksim Levental via cfe-commits


@@ -257,14 +256,9 @@ const char *const Runtimes = R"(
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, long double);
 void __clang_Interpreter_SetValueNoAlloc(void*,void*,void*,unsigned long 
long);
 template 
-void __clang_Interpreter_SetValueCopyArr(T* Src, void* Placement, unsigned 
long Size) {

makslevental wrote:

> We can’t outline templates because we are introducing an odr violation.

This is not correct - templates (subject to conditions satisfied here) are 
exempt from odr:

> There can be more than one definition of a [...] templated entity 
> ([temp.pre]) [...] in a program provided that each definition appears in a 
> different translation unit and the definitions satisfy the following 
> requirements.

https://timsong-cpp.github.io/cppwp/n4861/basic.def.odr#13

> We should move new behind a new non-templates operation which we can forward 
> declare and use within the template.

I don't know what you're describing here; feel free to take over this PR if you 
have a concrete design in mind.

https://github.com/llvm/llvm-project/pull/69072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-20 Thread Maksim Levental via cfe-commits

https://github.com/makslevental edited 
https://github.com/llvm/llvm-project/pull/69072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-19 Thread Maksim Levental via cfe-commits

https://github.com/makslevental updated 
https://github.com/llvm/llvm-project/pull/69072

>From 891cdd5ceea279362c3df221fd4ae73c142b2f7e Mon Sep 17 00:00:00 2001
From: max 
Date: Sat, 14 Oct 2023 12:46:42 -0500
Subject: [PATCH] [clang][repl] fix `new`

---
 clang/lib/Interpreter/Interpreter.cpp | 24 ---
 .../unittests/Interpreter/InterpreterTest.cpp | 19 ---
 2 files changed, 32 insertions(+), 11 deletions(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 7968c62cbd3e7b3..57514f2d0cc424d 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -248,7 +248,6 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-void* operator new(__SIZE_TYPE__, void* __p) noexcept;
 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);
@@ -257,14 +256,9 @@ const char *const Runtimes = R"(
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, long double);
 void __clang_Interpreter_SetValueNoAlloc(void*,void*,void*,unsigned long 
long);
 template 
-void __clang_Interpreter_SetValueCopyArr(T* Src, void* Placement, unsigned 
long Size) {
-  for (auto Idx = 0; Idx < Size; ++Idx)
-new ((void*)(((T*)Placement) + Idx)) T(Src[Idx]);
-}
+void __clang_Interpreter_SetValueCopyArr(T* Src, void* Placement, unsigned 
long Size);
 template 
-void __clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void* 
Placement, unsigned long Size) {
-  __clang_Interpreter_SetValueCopyArr(Src[0], Placement, Size);
-}
+void __clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void* 
Placement, unsigned long Size);
 )";
 
 llvm::Expected>
@@ -762,6 +756,20 @@ __clang_Interpreter_SetValueNoAlloc(void *This, void 
*OutVal,
   VRef = Value(static_cast(This), OpaqueType);
 }
 
+template 
+REPL_EXTERNAL_VISIBILITY void
+__clang_Interpreter_SetValueCopyArr(T *Src, void *Placement,
+unsigned long Size) {
+  for (unsigned long Idx = 0; Idx < Size; ++Idx)
+new ((void *)(((T *)Placement) + Idx)) T(Src[Idx]);
+}
+template 
+REPL_EXTERNAL_VISIBILITY void
+__clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void *Placement,
+unsigned long Size) {
+  __clang_Interpreter_SetValueCopyArr(Src[0], Placement, Size);
+}
+
 static void SetValueDataBasedOnQualType(Value , unsigned long long Data) {
   QualType QT = V.getType();
   if (const auto *ET = QT->getAs())
diff --git a/clang/unittests/Interpreter/InterpreterTest.cpp 
b/clang/unittests/Interpreter/InterpreterTest.cpp
index 5f2911e9a7adad3..6b4230a22357d2c 100644
--- a/clang/unittests/Interpreter/InterpreterTest.cpp
+++ b/clang/unittests/Interpreter/InterpreterTest.cpp
@@ -24,6 +24,7 @@
 #include "llvm/ExecutionEngine/Orc/LLJIT.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/TargetSelect.h"
+#include "llvm/TargetParser/Host.h"
 
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
@@ -45,13 +46,25 @@ static std::unique_ptr
 createInterpreter(const Args  = {},
   DiagnosticConsumer *Client = nullptr) {
   Args ClangArgs = {"-Xclang", "-emit-llvm-only"};
+  if (llvm::Triple(llvm::sys::getProcessTriple()).isOSDarwin()) {
+Args macOsArgs = {"-Xcc", "-isysroot",
+  "/Applications/Xcode.app/Contents/Developer/Platforms/"
+  "MacOSX.platform/Developer/SDKs/MacOSX.sdk"};
+ClangArgs.insert(ClangArgs.end(), macOsArgs.begin(), macOsArgs.end());
+  }
   ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
   auto CB = clang::IncrementalCompilerBuilder();
   CB.SetCompilerArgs(ClangArgs);
   auto CI = cantFail(CB.CreateCpp());
   if (Client)
 CI->getDiagnostics().setClient(Client, /*ShouldOwnClient=*/false);
-  return cantFail(clang::Interpreter::create(std::move(CI)));
+  auto interp = cantFail(clang::Interpreter::create(std::move(CI)));
+  if (llvm::Triple(llvm::sys::getProcessTriple()).isOSDarwin())
+(void)cantFail(interp->Parse("#include "));
+  else
+(void)cantFail(interp->Parse(
+"void* operator new(__SIZE_TYPE__, void* __p) noexcept;"));
+  return interp;
 }
 
 static size_t DeclsSize(TranslationUnitDecl *PTUDecl) {
@@ -148,12 +161,12 @@ TEST(InterpreterTest, UndoCommand) {
   auto Interp = createInterpreter(ExtraArgs, DiagPrinter.get());
 
   // Fail to undo.
-  auto Err1 = Interp->Undo();
+  auto Err1 = Interp->Undo(2);
   EXPECT_EQ("Operation failed. Too many undos",
 llvm::toString(std::move(Err1)));
   auto Err2 = Interp->Parse("int foo = 42;");
   EXPECT_TRUE(!!Err2);
-  auto Err3 = Interp->Undo(2);
+  auto Err3 = Interp->Undo(3);
   

[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-19 Thread Maksim Levental via cfe-commits

makslevental wrote:

@vgvassilev this seems acceptable?

https://github.com/llvm/llvm-project/pull/69072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-19 Thread Maksim Levental via cfe-commits

https://github.com/makslevental updated 
https://github.com/llvm/llvm-project/pull/69072

>From 940da2de0fc92e8e0da64fd35ad08effb6093447 Mon Sep 17 00:00:00 2001
From: max 
Date: Sat, 14 Oct 2023 12:46:42 -0500
Subject: [PATCH] [clang][repl] fix `new`

---
 clang/lib/Interpreter/Interpreter.cpp | 24 ---
 .../unittests/Interpreter/InterpreterTest.cpp | 21 +---
 2 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 7968c62cbd3e7b3..57514f2d0cc424d 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -248,7 +248,6 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-void* operator new(__SIZE_TYPE__, void* __p) noexcept;
 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);
@@ -257,14 +256,9 @@ const char *const Runtimes = R"(
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, long double);
 void __clang_Interpreter_SetValueNoAlloc(void*,void*,void*,unsigned long 
long);
 template 
-void __clang_Interpreter_SetValueCopyArr(T* Src, void* Placement, unsigned 
long Size) {
-  for (auto Idx = 0; Idx < Size; ++Idx)
-new ((void*)(((T*)Placement) + Idx)) T(Src[Idx]);
-}
+void __clang_Interpreter_SetValueCopyArr(T* Src, void* Placement, unsigned 
long Size);
 template 
-void __clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void* 
Placement, unsigned long Size) {
-  __clang_Interpreter_SetValueCopyArr(Src[0], Placement, Size);
-}
+void __clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void* 
Placement, unsigned long Size);
 )";
 
 llvm::Expected>
@@ -762,6 +756,20 @@ __clang_Interpreter_SetValueNoAlloc(void *This, void 
*OutVal,
   VRef = Value(static_cast(This), OpaqueType);
 }
 
+template 
+REPL_EXTERNAL_VISIBILITY void
+__clang_Interpreter_SetValueCopyArr(T *Src, void *Placement,
+unsigned long Size) {
+  for (unsigned long Idx = 0; Idx < Size; ++Idx)
+new ((void *)(((T *)Placement) + Idx)) T(Src[Idx]);
+}
+template 
+REPL_EXTERNAL_VISIBILITY void
+__clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void *Placement,
+unsigned long Size) {
+  __clang_Interpreter_SetValueCopyArr(Src[0], Placement, Size);
+}
+
 static void SetValueDataBasedOnQualType(Value , unsigned long long Data) {
   QualType QT = V.getType();
   if (const auto *ET = QT->getAs())
diff --git a/clang/unittests/Interpreter/InterpreterTest.cpp 
b/clang/unittests/Interpreter/InterpreterTest.cpp
index 5f2911e9a7adad3..4963846dffa6f98 100644
--- a/clang/unittests/Interpreter/InterpreterTest.cpp
+++ b/clang/unittests/Interpreter/InterpreterTest.cpp
@@ -24,10 +24,13 @@
 #include "llvm/ExecutionEngine/Orc/LLJIT.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/TargetSelect.h"
+#include "llvm/TargetParser/Host.h"
 
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
+#include 
+
 using namespace clang;
 
 #if defined(_AIX)
@@ -45,13 +48,25 @@ static std::unique_ptr
 createInterpreter(const Args  = {},
   DiagnosticConsumer *Client = nullptr) {
   Args ClangArgs = {"-Xclang", "-emit-llvm-only"};
+  if (llvm::Triple(llvm::sys::getProcessTriple()).isOSDarwin()) {
+Args macOsArgs = {"-Xcc", "-isysroot",
+  "/Applications/Xcode.app/Contents/Developer/Platforms/"
+  "MacOSX.platform/Developer/SDKs/MacOSX.sdk"};
+ClangArgs.insert(ClangArgs.end(), macOsArgs.begin(), macOsArgs.end());
+  }
   ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
   auto CB = clang::IncrementalCompilerBuilder();
   CB.SetCompilerArgs(ClangArgs);
   auto CI = cantFail(CB.CreateCpp());
   if (Client)
 CI->getDiagnostics().setClient(Client, /*ShouldOwnClient=*/false);
-  return cantFail(clang::Interpreter::create(std::move(CI)));
+  auto interp = cantFail(clang::Interpreter::create(std::move(CI)));
+  if (llvm::Triple(llvm::sys::getProcessTriple()).isOSDarwin())
+(void)cantFail(interp->Parse("#include "));
+  else
+(void)cantFail(interp->Parse(
+"void* operator new(__SIZE_TYPE__, void* __p) noexcept;"));
+  return interp;
 }
 
 static size_t DeclsSize(TranslationUnitDecl *PTUDecl) {
@@ -148,12 +163,12 @@ TEST(InterpreterTest, UndoCommand) {
   auto Interp = createInterpreter(ExtraArgs, DiagPrinter.get());
 
   // Fail to undo.
-  auto Err1 = Interp->Undo();
+  auto Err1 = Interp->Undo(2);
   EXPECT_EQ("Operation failed. Too many undos",
 llvm::toString(std::move(Err1)));
   auto Err2 = Interp->Parse("int foo = 42;");
   EXPECT_TRUE(!!Err2);
-  auto Err3 = 

[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-19 Thread Maksim Levental via cfe-commits

https://github.com/makslevental updated 
https://github.com/llvm/llvm-project/pull/69072

>From 737bef4f36139f0347e9ab58838e41aadbb45d16 Mon Sep 17 00:00:00 2001
From: max 
Date: Sat, 14 Oct 2023 12:46:42 -0500
Subject: [PATCH] [clang][repl] fix `new`

---
 clang/lib/Interpreter/Interpreter.cpp | 24 ---
 clang/test/Interpreter/execute.cpp|  2 ++
 .../unittests/Interpreter/InterpreterTest.cpp |  5 +++-
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 7968c62cbd3e7b3..57514f2d0cc424d 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -248,7 +248,6 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-void* operator new(__SIZE_TYPE__, void* __p) noexcept;
 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);
@@ -257,14 +256,9 @@ const char *const Runtimes = R"(
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, long double);
 void __clang_Interpreter_SetValueNoAlloc(void*,void*,void*,unsigned long 
long);
 template 
-void __clang_Interpreter_SetValueCopyArr(T* Src, void* Placement, unsigned 
long Size) {
-  for (auto Idx = 0; Idx < Size; ++Idx)
-new ((void*)(((T*)Placement) + Idx)) T(Src[Idx]);
-}
+void __clang_Interpreter_SetValueCopyArr(T* Src, void* Placement, unsigned 
long Size);
 template 
-void __clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void* 
Placement, unsigned long Size) {
-  __clang_Interpreter_SetValueCopyArr(Src[0], Placement, Size);
-}
+void __clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void* 
Placement, unsigned long Size);
 )";
 
 llvm::Expected>
@@ -762,6 +756,20 @@ __clang_Interpreter_SetValueNoAlloc(void *This, void 
*OutVal,
   VRef = Value(static_cast(This), OpaqueType);
 }
 
+template 
+REPL_EXTERNAL_VISIBILITY void
+__clang_Interpreter_SetValueCopyArr(T *Src, void *Placement,
+unsigned long Size) {
+  for (unsigned long Idx = 0; Idx < Size; ++Idx)
+new ((void *)(((T *)Placement) + Idx)) T(Src[Idx]);
+}
+template 
+REPL_EXTERNAL_VISIBILITY void
+__clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void *Placement,
+unsigned long Size) {
+  __clang_Interpreter_SetValueCopyArr(Src[0], Placement, Size);
+}
+
 static void SetValueDataBasedOnQualType(Value , unsigned long long Data) {
   QualType QT = V.getType();
   if (const auto *ET = QT->getAs())
diff --git a/clang/test/Interpreter/execute.cpp 
b/clang/test/Interpreter/execute.cpp
index 6e73ed3927e8155..d54ab99749c1bac 100644
--- a/clang/test/Interpreter/execute.cpp
+++ b/clang/test/Interpreter/execute.cpp
@@ -20,4 +20,6 @@ auto r2 = printf("S[f=%f, m=0x%llx]\n", s.f, 
reinterpret_cast
+
 %quit
diff --git a/clang/unittests/Interpreter/InterpreterTest.cpp 
b/clang/unittests/Interpreter/InterpreterTest.cpp
index 5f2911e9a7adad3..cc00d52d8d3bfa6 100644
--- a/clang/unittests/Interpreter/InterpreterTest.cpp
+++ b/clang/unittests/Interpreter/InterpreterTest.cpp
@@ -51,7 +51,10 @@ createInterpreter(const Args  = {},
   auto CI = cantFail(CB.CreateCpp());
   if (Client)
 CI->getDiagnostics().setClient(Client, /*ShouldOwnClient=*/false);
-  return cantFail(clang::Interpreter::create(std::move(CI)));
+  auto interp = cantFail(clang::Interpreter::create(std::move(CI)));
+  (void)cantFail(
+  interp->Parse("void* operator new(__SIZE_TYPE__, void* __p) noexcept;"));
+  return interp;
 }
 
 static size_t DeclsSize(TranslationUnitDecl *PTUDecl) {

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-19 Thread Maksim Levental via cfe-commits

https://github.com/makslevental updated 
https://github.com/llvm/llvm-project/pull/69072

>From f2d35a0f0356d5ea570019bc02558bd5fc143afb Mon Sep 17 00:00:00 2001
From: max 
Date: Sat, 14 Oct 2023 12:46:42 -0500
Subject: [PATCH 1/3] [clang][repl] fix `new`

---
 clang/lib/Interpreter/Interpreter.cpp | 2 +-
 clang/test/Interpreter/execute.cpp| 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 7968c62cbd3e7b3..ddfbc9ac01c6743 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -248,7 +248,7 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-void* operator new(__SIZE_TYPE__, void* __p) noexcept;
+#include 
 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);
diff --git a/clang/test/Interpreter/execute.cpp 
b/clang/test/Interpreter/execute.cpp
index 6e73ed3927e8155..d54ab99749c1bac 100644
--- a/clang/test/Interpreter/execute.cpp
+++ b/clang/test/Interpreter/execute.cpp
@@ -20,4 +20,6 @@ auto r2 = printf("S[f=%f, m=0x%llx]\n", s.f, 
reinterpret_cast
+
 %quit

>From a9799463a5d2a4bb2d788f871b454d5d3fa0add8 Mon Sep 17 00:00:00 2001
From: Maksim Levental 
Date: Sat, 14 Oct 2023 19:26:04 -0500
Subject: [PATCH 2/3] Update clang/lib/Interpreter/Interpreter.cpp

Remove include new

Co-authored-by: Vassil Vassilev 
---
 clang/lib/Interpreter/Interpreter.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index ddfbc9ac01c6743..30348e1c03f8c76 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -248,7 +248,6 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-#include 
 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);

>From d5e4a70a01054e667285f6b3ca77141ae63a71cb Mon Sep 17 00:00:00 2001
From: max 
Date: Sat, 14 Oct 2023 23:44:01 -0500
Subject: [PATCH 3/3] branch on isdarwin

---
 clang/lib/Interpreter/Interpreter.cpp | 28 +--
 clang/test/Interpreter/execute.cpp|  2 --
 .../unittests/Interpreter/InterpreterTest.cpp | 25 -
 3 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 30348e1c03f8c76..a249a12b3a1aaf9 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -244,28 +244,6 @@ Interpreter::~Interpreter() {
   }
 }
 
-// These better to put in a runtime header but we can't. This is because we
-// can't find the precise resource directory in unittests so we have to hard
-// code them.
-const char *const Runtimes = R"(
-void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
-void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
-void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);
-void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, float);
-void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, double);
-void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, long double);
-void __clang_Interpreter_SetValueNoAlloc(void*,void*,void*,unsigned long 
long);
-template 
-void __clang_Interpreter_SetValueCopyArr(T* Src, void* Placement, unsigned 
long Size) {
-  for (auto Idx = 0; Idx < Size; ++Idx)
-new ((void*)(((T*)Placement) + Idx)) T(Src[Idx]);
-}
-template 
-void __clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void* 
Placement, unsigned long Size) {
-  __clang_Interpreter_SetValueCopyArr(Src[0], Placement, Size);
-}
-)";
-
 llvm::Expected>
 Interpreter::create(std::unique_ptr CI) {
   llvm::Error Err = llvm::Error::success();
@@ -274,10 +252,6 @@ Interpreter::create(std::unique_ptr CI) {
   if (Err)
 return std::move(Err);
 
-  auto PTU = Interp->Parse(Runtimes);
-  if (!PTU)
-return PTU.takeError();
-
   Interp->ValuePrintingInfo.resize(3);
   // FIXME: This is a ugly hack. Undo command checks its availability by 
looking
   // at the size of the PTU list. However we have parsed something in the
@@ -351,7 +325,7 @@ Interpreter::Parse(llvm::StringRef Code) {
   return std::move(E);
   }
 
-  // Tell the interpreter sliently ignore unused expressions since value
+  // Tell the interpreter silently ignore unused expressions since value
   // printing could cause it.
 

[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-19 Thread Maksim Levental via cfe-commits

https://github.com/makslevental updated 
https://github.com/llvm/llvm-project/pull/69072

>From d7c57d94d7e75ed1e0df87ebf3c4464e7b951453 Mon Sep 17 00:00:00 2001
From: max 
Date: Sat, 14 Oct 2023 12:46:42 -0500
Subject: [PATCH 1/3] [clang][repl] fix `new`

---
 clang/lib/Interpreter/Interpreter.cpp | 2 +-
 clang/test/Interpreter/execute.cpp| 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 7968c62cbd3e7b3..ddfbc9ac01c6743 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -248,7 +248,7 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-void* operator new(__SIZE_TYPE__, void* __p) noexcept;
+#include 
 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);
diff --git a/clang/test/Interpreter/execute.cpp 
b/clang/test/Interpreter/execute.cpp
index 6e73ed3927e8155..d54ab99749c1bac 100644
--- a/clang/test/Interpreter/execute.cpp
+++ b/clang/test/Interpreter/execute.cpp
@@ -20,4 +20,6 @@ auto r2 = printf("S[f=%f, m=0x%llx]\n", s.f, 
reinterpret_cast
+
 %quit

>From b3c62d0d295129ad94f94fc641e789038c78f03a Mon Sep 17 00:00:00 2001
From: Maksim Levental 
Date: Sat, 14 Oct 2023 19:26:04 -0500
Subject: [PATCH 2/3] Update clang/lib/Interpreter/Interpreter.cpp

Remove include new

Co-authored-by: Vassil Vassilev 
---
 clang/lib/Interpreter/Interpreter.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index ddfbc9ac01c6743..30348e1c03f8c76 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -248,7 +248,6 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-#include 
 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);

>From 9a071b39c2b31aa9bb1c2dfdd5de139666a06c1d Mon Sep 17 00:00:00 2001
From: max 
Date: Sat, 14 Oct 2023 23:44:01 -0500
Subject: [PATCH 3/3] branch on isdarwin

---
 clang/lib/Interpreter/Interpreter.cpp | 28 +--
 clang/test/Interpreter/ClangReplPrologue.h| 26 +
 clang/test/Interpreter/code-undo.cpp  |  5 +++-
 clang/test/Interpreter/const.cpp  |  6 ++--
 .../Interpreter/disambiguate-decl-stmt.cpp|  6 ++--
 clang/test/Interpreter/dynamic-library.cpp|  4 ++-
 clang/test/Interpreter/execute-stmts.cpp  |  5 ++--
 clang/test/Interpreter/execute-weak.cpp   |  4 ++-
 clang/test/Interpreter/execute.cpp|  7 +++--
 clang/test/Interpreter/fail.cpp   |  5 +++-
 clang/test/Interpreter/global-dtor.cpp|  4 ++-
 clang/test/Interpreter/inline-virtual.cpp |  6 ++--
 clang/test/Interpreter/lambda.cpp |  7 +++--
 clang/test/Interpreter/multiline.cpp  |  4 ++-
 clang/test/Interpreter/plugins.cpp|  4 ++-
 clang/test/Interpreter/simple-exception.cpp   |  4 ++-
 clang/test/Interpreter/stmt-serialization.cpp |  4 ++-
 17 files changed, 81 insertions(+), 48 deletions(-)
 create mode 100644 clang/test/Interpreter/ClangReplPrologue.h

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 30348e1c03f8c76..a249a12b3a1aaf9 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -244,28 +244,6 @@ Interpreter::~Interpreter() {
   }
 }
 
-// These better to put in a runtime header but we can't. This is because we
-// can't find the precise resource directory in unittests so we have to hard
-// code them.
-const char *const Runtimes = R"(
-void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
-void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
-void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);
-void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, float);
-void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, double);
-void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, long double);
-void __clang_Interpreter_SetValueNoAlloc(void*,void*,void*,unsigned long 
long);
-template 
-void __clang_Interpreter_SetValueCopyArr(T* Src, void* Placement, unsigned 
long Size) {
-  for (auto Idx = 0; Idx < Size; ++Idx)
-new ((void*)(((T*)Placement) + Idx)) T(Src[Idx]);
-}
-template 
-void __clang_Interpreter_SetValueCopyArr(const T (*Src)[N], void* 
Placement, unsigned long 

[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-15 Thread Maksim Levental via cfe-commits

https://github.com/makslevental edited 
https://github.com/llvm/llvm-project/pull/69072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-15 Thread Maksim Levental via cfe-commits

https://github.com/makslevental edited 
https://github.com/llvm/llvm-project/pull/69072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-15 Thread Maksim Levental via cfe-commits

https://github.com/makslevental edited 
https://github.com/llvm/llvm-project/pull/69072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-15 Thread Maksim Levental via cfe-commits

https://github.com/makslevental edited 
https://github.com/llvm/llvm-project/pull/69072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-15 Thread Maksim Levental via cfe-commits


@@ -275,7 +274,14 @@ Interpreter::create(std::unique_ptr CI) {
   if (Err)
 return std::move(Err);
 
-  auto PTU = Interp->Parse(Runtimes);
+  std::string runtimes = "";
+  if (llvm::Triple(llvm::sys::getProcessTriple()).isOSDarwin())
+runtimes += "#include \n";

makslevental wrote:

Okay let me try to explain the bug again:

In Interpreter.cpp you have a series of decls and a define **are always parsed 
at interpreter startup** in `const char *const Runtimes`:

https://github.com/llvm/llvm-project/blob/6dfea561ba96974b205c31546c5e2069429c75b1/clang/lib/Interpreter/Interpreter.cpp#L250-L268

Currently there's a forward decl for `new` _and_ a subsequent use of placement 
`new` (in `__clang_Interpreter_SetValueCopyArr`). I don't know why because I am 
not yet familiar with the codebase - @junaire added the code. The comment above 
suggests it might be for the sake of enabling unittests?

On Linux and Windows this seems to work (I'm guessing since none of the tests 
fail) but on Mac (at least M1), this leads to the error mentioned above if the 
user ever loads ``, e.g., as a transivitive include from somewhere else, 
because the forward decl in `Runtimes` clashes with what the sysroot has.

I tried your suggestion to just remove any forward decl to `new` and [it didn't 
work](https://buildkite.com/llvm-project/github-pull-requests/builds/7769). 
Removing it just for Mac (if that's what you meant since you highlighted only 
that case) seems like really bad UX.

https://github.com/llvm/llvm-project/pull/69072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-14 Thread Maksim Levental via cfe-commits

https://github.com/makslevental updated 
https://github.com/llvm/llvm-project/pull/69072

>From d7c57d94d7e75ed1e0df87ebf3c4464e7b951453 Mon Sep 17 00:00:00 2001
From: max 
Date: Sat, 14 Oct 2023 12:46:42 -0500
Subject: [PATCH 1/3] [clang][repl] fix `new`

---
 clang/lib/Interpreter/Interpreter.cpp | 2 +-
 clang/test/Interpreter/execute.cpp| 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 7968c62cbd3e7b3..ddfbc9ac01c6743 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -248,7 +248,7 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-void* operator new(__SIZE_TYPE__, void* __p) noexcept;
+#include 
 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);
diff --git a/clang/test/Interpreter/execute.cpp 
b/clang/test/Interpreter/execute.cpp
index 6e73ed3927e8155..d54ab99749c1bac 100644
--- a/clang/test/Interpreter/execute.cpp
+++ b/clang/test/Interpreter/execute.cpp
@@ -20,4 +20,6 @@ auto r2 = printf("S[f=%f, m=0x%llx]\n", s.f, 
reinterpret_cast
+
 %quit

>From b3c62d0d295129ad94f94fc641e789038c78f03a Mon Sep 17 00:00:00 2001
From: Maksim Levental 
Date: Sat, 14 Oct 2023 19:26:04 -0500
Subject: [PATCH 2/3] Update clang/lib/Interpreter/Interpreter.cpp

Remove include new

Co-authored-by: Vassil Vassilev 
---
 clang/lib/Interpreter/Interpreter.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index ddfbc9ac01c6743..30348e1c03f8c76 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -248,7 +248,6 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-#include 
 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);

>From cfb0771a5040d48f3a41108e541ed6f467438f4e Mon Sep 17 00:00:00 2001
From: max 
Date: Sat, 14 Oct 2023 23:44:01 -0500
Subject: [PATCH 3/3] branch on isdarwin

---
 clang/lib/Interpreter/Interpreter.cpp | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 30348e1c03f8c76..dcb214a88806916 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -274,7 +274,14 @@ Interpreter::create(std::unique_ptr CI) {
   if (Err)
 return std::move(Err);
 
-  auto PTU = Interp->Parse(Runtimes);
+  std::string runtimes = "";
+  if (llvm::Triple(llvm::sys::getProcessTriple()).isOSDarwin())
+runtimes += "#include \n";
+  else
+runtimes += "void* operator new(__SIZE_TYPE__, void* __p) noexcept;\n";
+  runtimes += Runtimes;
+
+  auto PTU = Interp->Parse(runtimes);
   if (!PTU)
 return PTU.takeError();
 

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-14 Thread Maksim Levental via cfe-commits


@@ -248,7 +248,7 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-void* operator new(__SIZE_TYPE__, void* __p) noexcept;
+#include 

makslevental wrote:

Ya so you need something here.

https://github.com/llvm/llvm-project/pull/69072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-14 Thread Maksim Levental via cfe-commits

https://github.com/makslevental updated 
https://github.com/llvm/llvm-project/pull/69072

>From d7c57d94d7e75ed1e0df87ebf3c4464e7b951453 Mon Sep 17 00:00:00 2001
From: max 
Date: Sat, 14 Oct 2023 12:46:42 -0500
Subject: [PATCH 1/2] [clang][repl] fix `new`

---
 clang/lib/Interpreter/Interpreter.cpp | 2 +-
 clang/test/Interpreter/execute.cpp| 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 7968c62cbd3e7b3..ddfbc9ac01c6743 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -248,7 +248,7 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-void* operator new(__SIZE_TYPE__, void* __p) noexcept;
+#include 
 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);
diff --git a/clang/test/Interpreter/execute.cpp 
b/clang/test/Interpreter/execute.cpp
index 6e73ed3927e8155..d54ab99749c1bac 100644
--- a/clang/test/Interpreter/execute.cpp
+++ b/clang/test/Interpreter/execute.cpp
@@ -20,4 +20,6 @@ auto r2 = printf("S[f=%f, m=0x%llx]\n", s.f, 
reinterpret_cast
+
 %quit

>From b3c62d0d295129ad94f94fc641e789038c78f03a Mon Sep 17 00:00:00 2001
From: Maksim Levental 
Date: Sat, 14 Oct 2023 19:26:04 -0500
Subject: [PATCH 2/2] Update clang/lib/Interpreter/Interpreter.cpp

Remove include new

Co-authored-by: Vassil Vassilev 
---
 clang/lib/Interpreter/Interpreter.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index ddfbc9ac01c6743..30348e1c03f8c76 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -248,7 +248,6 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-#include 
 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-14 Thread Maksim Levental via cfe-commits


@@ -20,4 +20,6 @@ auto r2 = printf("S[f=%f, m=0x%llx]\n", s.f, 
reinterpret_cast

makslevental wrote:

This was to test (since `` transitively includes ``).

https://github.com/llvm/llvm-project/pull/69072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-14 Thread Maksim Levental via cfe-commits


@@ -248,7 +248,7 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-void* operator new(__SIZE_TYPE__, void* __p) noexcept;
+#include 

makslevental wrote:

There's a placement `new` just below here (in this block of lines that's always 
interpreted). I didn't try just removing but I can.

https://github.com/llvm/llvm-project/pull/69072
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][repl] fix `new` on Mac M1 (PR #69072)

2023-10-14 Thread Maksim Levental via cfe-commits

https://github.com/makslevental created 
https://github.com/llvm/llvm-project/pull/69072

On Mac M1, if you load something that transitively loads `#include `, it 
will fail because 

```
In file included from <<< inputs >>>:1:
In file included from input_line_22:1:
In file included from 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/memory:671:
In file included from 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/__functional_base:23:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/new:214:70:
 error: 'internal_linkage' attribute does not appear on the first declaration
  214 | _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* 
operator new  (std::size_t, void* __p) _NOEXCEPT {return __p;}
  |  ^
input_line_0:3:11: note: previous declaration is here
3 | void* operator new(__SIZE_TYPE__, void* __p) noexcept;
  |   ^
Assertion failed: (Ptr && "dereferencing end() iterator"), function operator*, 
file DeclBase.h, line 1315.
```

This is because `MacOSX12.3.sdk/usr/include/c++/v1/__config` sets 
`_LIBCPP_INLINE_VISIBILITY` to be `__attribute__((__visibility__("hidden"))) 
__attribute__((internal_linkage))`, which makes the `new` in `` 
incompatible with the hardcoded decl `void* operator new(__SIZE_TYPE__, void* 
__p) noexcept;` in `clang/lib/Interpreter/Interpreter::Runtimes`. I believe the 
correct thing to do is replace that decl with `#include ` (as I've done 
here).

>From d7c57d94d7e75ed1e0df87ebf3c4464e7b951453 Mon Sep 17 00:00:00 2001
From: max 
Date: Sat, 14 Oct 2023 12:46:42 -0500
Subject: [PATCH] [clang][repl] fix `new`

---
 clang/lib/Interpreter/Interpreter.cpp | 2 +-
 clang/test/Interpreter/execute.cpp| 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 7968c62cbd3e7b3..ddfbc9ac01c6743 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -248,7 +248,7 @@ Interpreter::~Interpreter() {
 // can't find the precise resource directory in unittests so we have to hard
 // code them.
 const char *const Runtimes = R"(
-void* operator new(__SIZE_TYPE__, void* __p) noexcept;
+#include 
 void *__clang_Interpreter_SetValueWithAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*);
 void __clang_Interpreter_SetValueNoAlloc(void*, void*, void*, void*);
diff --git a/clang/test/Interpreter/execute.cpp 
b/clang/test/Interpreter/execute.cpp
index 6e73ed3927e8155..d54ab99749c1bac 100644
--- a/clang/test/Interpreter/execute.cpp
+++ b/clang/test/Interpreter/execute.cpp
@@ -20,4 +20,6 @@ auto r2 = printf("S[f=%f, m=0x%llx]\n", s.f, 
reinterpret_cast
+
 %quit

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits