[llvm] [LLVM-C] Add binding to `BitcodeReader::getBitcodeProducerString` (PR #166063)

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 2 04:35:56 PST 2025


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 h,c,cpp -- llvm/include/llvm-c/BitReader.h llvm/lib/Bitcode/Reader/BitReader.cpp llvm/tools/llvm-c-test/llvm-c-test.h llvm/tools/llvm-c-test/main.c llvm/tools/llvm-c-test/module.c --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/Bitcode/Reader/BitReader.cpp b/llvm/lib/Bitcode/Reader/BitReader.cpp
index acce1e38d..2163e4d90 100644
--- a/llvm/lib/Bitcode/Reader/BitReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitReader.cpp
@@ -132,16 +132,14 @@ LLVMBool LLVMGetBitcodeModule2(LLVMMemoryBufferRef MemBuf,
 }
 
 LLVMBool LLVMGetBitcodeProducerString(LLVMMemoryBufferRef MemBuf,
-                                      char **OutProducer,
-                                      char **OutMessage) {
+                                      char **OutProducer, char **OutMessage) {
   MemoryBufferRef Buf = unwrap(MemBuf)->getMemBufferRef();
 
   Expected<std::string> ProducerOrErr = getBitcodeProducerString(Buf);
   if (!ProducerOrErr) {
     std::string Message;
-    handleAllErrors(ProducerOrErr.takeError(), [&](ErrorInfoBase &EIB) {
-      Message = EIB.message();
-    });
+    handleAllErrors(ProducerOrErr.takeError(),
+                    [&](ErrorInfoBase &EIB) { Message = EIB.message(); });
     if (OutMessage)
       *OutMessage = strdup(Message.c_str());
     if (OutProducer)
diff --git a/llvm/tools/llvm-c-test/main.c b/llvm/tools/llvm-c-test/main.c
index e38272c6f..5d532d0d5 100644
--- a/llvm/tools/llvm-c-test/main.c
+++ b/llvm/tools/llvm-c-test/main.c
@@ -34,8 +34,9 @@ static void print_usage(void) {
   fprintf(stderr, "  * --module-list-globals\n");
   fprintf(stderr, "    Read bitcode from stdin - list summary of globals\n\n");
   fprintf(stderr, "  * --module-get-producer-string\n");
-  fprintf(stderr,
-          "    Read bitcode from stdin - print the producer identification\n\n");
+  fprintf(
+      stderr,
+      "    Read bitcode from stdin - print the producer identification\n\n");
   fprintf(stderr, "  * --targets-list\n");
   fprintf(stderr, "    List available targets\n\n");
   fprintf(stderr, "  * --object-list-sections\n");

``````````

</details>


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


More information about the llvm-commits mailing list