[llvm] [SPIR-V][NFC] More efficient getPaddedLen (PR #105823)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 05:45: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 7b4b85b75d22a792b2ef80e6af4f0faf18da0a43 c756958fa58e5b75cab2601cc6d4577ec8ab0152 --extensions cpp -- llvm/lib/Target/SPIRV/SPIRVUtils.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/SPIRV/SPIRVUtils.cpp b/llvm/lib/Target/SPIRV/SPIRVUtils.cpp
index 68f166d0be..ab1365e40d 100644
--- a/llvm/lib/Target/SPIRV/SPIRVUtils.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVUtils.cpp
@@ -43,9 +43,7 @@ static uint32_t convertCharsToWord(const StringRef &Str, unsigned i) {
 }
 
 // Get length including padding and null terminator.
-static size_t getPaddedLen(const StringRef &Str) {
-  return Str.size() + 4 & ~3;
-}
+static size_t getPaddedLen(const StringRef &Str) { return Str.size() + 4 & ~3; }
 
 void addStringImm(const StringRef &Str, MCInst &Inst) {
   const size_t PaddedLen = getPaddedLen(Str);

``````````

</details>


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


More information about the llvm-commits mailing list