[llvm] [ADT] Make hexdigit static (PR #94287)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 3 15:21:50 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Jacob Lambert (lamb-j)
<details>
<summary>Changes</summary>
By setting hexdigit to static, we avoid inadvertently exposing the symbol when creating an LLVM-based static library.
Without setting it to static, we see the following symbol when calling objdump -t -C on a static library calling LLVM APIs:
.rodata._ZZN4llvm8hexdigitEjbE3LU
---
Full diff: https://github.com/llvm/llvm-project/pull/94287.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/StringExtras.h (+1-1)
``````````diff
diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h
index 20e6ad1f68f99..bb33a8d867f59 100644
--- a/llvm/include/llvm/ADT/StringExtras.h
+++ b/llvm/include/llvm/ADT/StringExtras.h
@@ -34,7 +34,7 @@ class raw_ostream;
/// hexdigit - Return the hexadecimal character for the
/// given number \p X (which should be less than 16).
-inline char hexdigit(unsigned X, bool LowerCase = false) {
+static inline char hexdigit(unsigned X, bool LowerCase = false) {
assert(X < 16);
static const char LUT[] = "0123456789ABCDEF";
const uint8_t Offset = LowerCase ? 32 : 0;
``````````
</details>
https://github.com/llvm/llvm-project/pull/94287
More information about the llvm-commits
mailing list