[llvm] [llvm-objdump] Add --substitute-path and --source-dir for --source (PR #201096)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 02:09:45 PDT 2026


================
@@ -3906,17 +3905,16 @@ static void parseObjdumpOptions(const llvm::opt::InputArgList &InputArgs) {
   UnwindShowWODPool = InputArgs.hasArg(OBJDUMP_unwind_show_wod_pool);
   Prefix = InputArgs.getLastArgValue(OBJDUMP_prefix).str();
   parseIntArg(InputArgs, OBJDUMP_prefix_strip, PrefixStrip);
-  for (const opt::Arg *A : InputArgs.filtered(OBJDUMP_substitute_path))
-    SubstitutePaths.emplace_back(A->getValue(0), A->getValue(1));
-  for (StringRef Dirs : InputArgs.getAllArgValues(OBJDUMP_source_dir)) {
-#if defined(_WIN32)
-    for (StringRef Dir : llvm::split(Dirs, ";"))
-#else
-    for (StringRef Dir : llvm::split(Dirs, ":"))
-#endif
-      if (!Dir.empty())
-        SourceDirs.insert(SourceDirs.end(), Dir.str());
+  for (const opt::Arg *A : InputArgs.filtered(OBJDUMP_substitute_path)) {
+    StringRef From = A->getValue(0);
+    if (From.empty())
+      reportCmdLineError(A->getSpelling() +
+                         ": <from> must not be empty");
+    SubstitutePaths.emplace_back(From.str(), A->getValue(1));
   }
+  for (StringRef Dir : InputArgs.getAllArgValues(OBJDUMP_source_dir))
+    if (!Dir.empty())
----------------
jh7370 wrote:

I think we should just reject this case as an error.

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


More information about the llvm-commits mailing list