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

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 19 16:45:34 PDT 2023


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

I think I understand. One way out would be to move that call of new into a new function whose definition is available only at compile time, forward declare it uniformly here and use it. 

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


More information about the cfe-commits mailing list