================
@@ -184,20 +184,18 @@ CreateCI(const llvm::opt::ArgStringList &Argv) {
                                    "Initialization failed. "
                                    "Unable to flush diagnostics");
 
-  // FIXME: Merge with CompilerInstance::ExecuteAction.
-  llvm::MemoryBuffer *MB = llvm::MemoryBuffer::getMemBuffer("").release();
-  Clang->getPreprocessorOpts().addRemappedFile("<<< inputs >>>", MB);
-
-  Clang->setTarget(TargetInfo::CreateTargetInfo(
-      Clang->getDiagnostics(), Clang->getInvocation().getTargetOpts()));
-  if (!Clang->hasTarget())
+  // The driver passes "<<< inputs >>>" as a placeholder main file; the real
+  // input arrives later as input_line_N buffers.
+  for (FrontendInputFile &Input : Clang->getFrontendOpts().Inputs)
+    if (Input.isFile() && Input.getFile() == "<<< inputs >>>")
+      Input = FrontendInputFile(llvm::MemoryBufferRef("", "<<< inputs >>>"),
----------------
AdityaSinha149 wrote:

Yeah that solved it, thanks for the review. PTAL!

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

Reply via email to