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

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 00:51:35 PDT 2026


================
@@ -608,8 +705,16 @@ bool SourcePrinter::cacheSource(const DILineInfo &LineInfo) {
   if (LineInfo.Source) {
     Buffer = MemoryBuffer::getMemBuffer(*LineInfo.Source);
   } else {
-    auto BufferOrError =
-        MemoryBuffer::getFile(LineInfo.FileName, /*IsText=*/true);
+    std::string PathToOpen = LineInfo.FileName;
+    if (!SourceDirs.empty()) {
+      SmallVector<StringRef, 8> SearchDirs;
+      for (const std::string &Dir : SourceDirs)
+        SearchDirs.push_back(Dir);
+      if (auto Resolved = findSourceFilePath(LineInfo.FileName, SearchDirs))
----------------
jh7370 wrote:

I don't think this should be `auto` per the LLVM style guide on `auto` usage.

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


More information about the llvm-commits mailing list