================
@@ -736,10 +736,13 @@ int cc1as_main(ArrayRef<const char *> Argv, const char 
*Argv0, void *MainAddr) {
     for (unsigned i = 0; i != NumArgs; ++i)
       Args[i + 1] = Asm.LLVMArgs[i].c_str();
     Args[NumArgs + 1] = nullptr;
-    cl::parseCommandLineOptions(LibraryOptions,
-                                ArrayRef(Args.get(), NumArgs + 1),
-                                /*Overview=*/"", /*Errs=*/nullptr,
-                                /*VFS=*/VFS.get());
+    // With no stream to report to, the parser calls exit(), which ends the
+    // process that embeds clang. Keep its output where it already went.
+    if (!cl::parseCommandLineOptions(LibraryOptions,
+                                     ArrayRef(Args.get(), NumArgs + 1),
+                                     /*Overview=*/"", /*Errs=*/&llvm::errs(),
+                                     /*VFS=*/VFS.get()))
+      Diags.Report(diag::err_fe_invalid_forwarded_option) << 0;
----------------
ChenMiaoi wrote:

Same

https://github.com/llvm/llvm-project/pull/229781
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to