[llvm] [BOLT] Replace LLVM_ATTRIBUTE_UNUSED with [[maybe_unused]] (NFC) (PR #163700)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 15 22:38:18 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-bolt
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
This patch replaces LLVM_ATTRIBUTE_UNUSED with [[maybe_unused]],
introduced as part of C++17.
---
Full diff: https://github.com/llvm/llvm-project/pull/163700.diff
3 Files Affected:
- (modified) bolt/lib/Core/CallGraph.cpp (+2-2)
- (modified) bolt/lib/Core/DebugData.cpp (+1-1)
- (modified) bolt/lib/Rewrite/DWARFRewriter.cpp (+1-1)
``````````diff
diff --git a/bolt/lib/Core/CallGraph.cpp b/bolt/lib/Core/CallGraph.cpp
index f1d52737bf556..f07add3a88112 100644
--- a/bolt/lib/Core/CallGraph.cpp
+++ b/bolt/lib/Core/CallGraph.cpp
@@ -22,7 +22,7 @@
#undef USE_SSECRC
#endif
-static LLVM_ATTRIBUTE_UNUSED inline size_t hash_int64_fallback(int64_t k) {
+[[maybe_unused]] static inline size_t hash_int64_fallback(int64_t k) {
uint64_t key = (unsigned long long)k;
// "64 bit Mix Functions", from Thomas Wang's "Integer Hash Function."
// http://www.concentric.net/~ttwang/tech/inthash.htm
@@ -35,7 +35,7 @@ static LLVM_ATTRIBUTE_UNUSED inline size_t hash_int64_fallback(int64_t k) {
return static_cast<size_t>(static_cast<uint32_t>(key));
}
-static LLVM_ATTRIBUTE_UNUSED inline size_t hash_int64(int64_t k) {
+[[maybe_unused]] static inline size_t hash_int64(int64_t k) {
#if defined(USE_SSECRC) && defined(__SSE4_2__)
size_t h = 0;
__asm("crc32q %1, %0\n" : "+r"(h) : "rm"(k));
diff --git a/bolt/lib/Core/DebugData.cpp b/bolt/lib/Core/DebugData.cpp
index 24a4c852e9d7e..2687788167a8a 100644
--- a/bolt/lib/Core/DebugData.cpp
+++ b/bolt/lib/Core/DebugData.cpp
@@ -101,7 +101,7 @@ std::optional<AttrInfo> findAttributeInfo(const DWARFDie DIE,
return findAttributeInfo(DIE, AbbrevDecl, *Index);
}
-LLVM_ATTRIBUTE_UNUSED
+[[maybe_unused]]
static void printLE64(const std::string &S) {
for (uint32_t I = 0, Size = S.size(); I < Size; ++I) {
errs() << Twine::utohexstr(S[I]);
diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index a7a4b664693fc..5e3fa931e826f 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -69,7 +69,7 @@ static void printDie(const DWARFDie &DIE) {
}
/// Lazily parse DWARF DIE and print it out.
-LLVM_ATTRIBUTE_UNUSED
+[[maybe_unused]]
static void printDie(DWARFUnit &DU, uint64_t DIEOffset) {
uint64_t OriginalOffsets = DIEOffset;
uint64_t NextCUOffset = DU.getNextUnitOffset();
``````````
</details>
https://github.com/llvm/llvm-project/pull/163700
More information about the llvm-commits
mailing list