[llvm] [MC][AsmParser]: Cache files loaded by .incbin across repeated directives (PR #194254)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 05:35:11 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- llvm/lib/MC/MCParser/AsmParser.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 82e86b966..10b9e57dc 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -865,16 +865,13 @@ bool AsmParser::processIncbinFile(const std::string &Filename, int64_t Skip,
 
   unsigned BufferIdx = 0;
   auto It = IncbinFileCache.find(Filename);
-  if (It == IncbinFileCache.end())
-  {
+  if (It == IncbinFileCache.end()) {
     std::string IncludedFile;
-    BufferIdx =
-        SrcMgr.AddIncludeFile(Filename, Lexer.getLoc(), IncludedFile);
+    BufferIdx = SrcMgr.AddIncludeFile(Filename, Lexer.getLoc(), IncludedFile);
     if (!BufferIdx)
       return true;
     IncbinFileCache.try_emplace(Filename, BufferIdx);
-  }
-  else
+  } else
     BufferIdx = It->second;
 
   if (!BufferIdx)

``````````

</details>


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


More information about the llvm-commits mailing list