[flang-commits] [flang] [flang][Driver] Improve error message for assembly file input (PR #174069)

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Wed Dec 31 09:25:30 PST 2025


================
@@ -97,6 +115,15 @@ int main(int argc, const char **argv) {
   llvm::StringSaver saver(a);
   ExpandResponseFiles(saver, args);
 
+    // Check if any input file is an assembly file before processing
+  if (hasAssemblyInput(args)) {
+    llvm::errs() << "error: Currently, the driver does not accept assembly "
+                << "code. Use clang instead. "
+                << "Note that '-lflang_rt.runtime -lm' is required for "
+                << "linking.\n";
----------------
tarunprabhu wrote:

This diagnostic message can be confusing to end users. For instance, they may not know what a "driver" is in this context. I would keep the diagnostic simple and just say:

"flang does not accept assembly code"

The suggestions for what to do can be useful, but I would expect that anyone who is handing over assembly code files directly is already sophisticated enough to try clang if flang does not work.

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


More information about the flang-commits mailing list