[llvm] [llvm-c] Add non-cstring versions of LLVMGetNamedFunction and LLVMGetNamedGlobal (PR #103396)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 12:23:24 PDT 2024


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 5b40a05d8f2872e4822fd5ff18383fbd5944f511 b0445e87ccb4363b94ebbdaa9b01f63ca8e492c2 --extensions cpp,h -- llvm/include/llvm-c/Core.h llvm/lib/IR/Core.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 896a5e6193..7d2e7c9552 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -1179,7 +1179,6 @@ LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name,
  */
 LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name);
 
-
 /**
  * Obtain a Function value from a Module by its name.
  *
@@ -1187,7 +1186,8 @@ LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name);
  *
  * @see llvm::Module::getFunction()
  */
-LLVMValueRef LLVMGetNamedFunctionWithLength(LLVMModuleRef M, const char *Name, size_t Length);
+LLVMValueRef LLVMGetNamedFunctionWithLength(LLVMModuleRef M, const char *Name,
+                                            size_t Length);
 
 /**
  * Obtain an iterator to the first Function in a Module.
@@ -2643,7 +2643,8 @@ LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty,
                                          const char *Name,
                                          unsigned AddressSpace);
 LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name);
-LLVMValueRef LLVMGetNamedGlobalWithLength(LLVMModuleRef M, const char *Name, size_t Length);
+LLVMValueRef LLVMGetNamedGlobalWithLength(LLVMModuleRef M, const char *Name,
+                                          size_t Length);
 LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M);
 LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M);
 LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar);
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index 52c58c273e..dcad76ee84 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -2203,7 +2203,8 @@ LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name) {
   return wrap(unwrap(M)->getNamedGlobal(Name));
 }
 
-LLVMValueRef LLVMGetNamedGlobalWithLength(LLVMModuleRef M, const char *Name, size_t Length) {
+LLVMValueRef LLVMGetNamedGlobalWithLength(LLVMModuleRef M, const char *Name,
+                                          size_t Length) {
   return wrap(unwrap(M)->getNamedGlobal(StringRef(Name, Length)));
 }
 
@@ -2385,7 +2386,8 @@ LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name) {
   return wrap(unwrap(M)->getFunction(Name));
 }
 
-LLVMValueRef LLVMGetNamedFunctionWithLength(LLVMModuleRef M, const char *Name, size_t Length) {
+LLVMValueRef LLVMGetNamedFunctionWithLength(LLVMModuleRef M, const char *Name,
+                                            size_t Length) {
   return wrap(unwrap(M)->getFunction(StringRef(Name, Length)));
 }
 

``````````

</details>


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


More information about the llvm-commits mailing list