[llvm] ForceFunctionAttrs: Use reportFatalUsageError (PR #139473)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu May 15 05:59:40 PDT 2025


================
@@ -91,8 +91,12 @@ PreservedAnalyses ForceFunctionAttrsPass::run(Module &M,
   bool Changed = false;
   if (!CSVFilePath.empty()) {
     auto BufferOrError = MemoryBuffer::getFileOrSTDIN(CSVFilePath);
-    if (!BufferOrError)
-      report_fatal_error("Cannot open CSV file.");
+    if (!BufferOrError) {
+      std::error_code EC = BufferOrError.getError();
+      M.getContext().emitError("cannot open CSV file: " + EC.message());
+      return PreservedAnalyses::all();
----------------
fhahn wrote:

The whole flag seems a bit unusual to me, would it make more sense to just continue w/o the file if it doesn't exist after printing an error?

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


More information about the llvm-commits mailing list