[llvm] [NFCI][Globals]For GlobalObjects, add updateSectionPrefix and change setSectionPrefix to handle empty strings (PR #158460)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 13 23:53:17 PDT 2025
================
@@ -121,9 +121,14 @@ class GlobalObject : public GlobalValue {
/// appropriate default object file section.
LLVM_ABI void setSection(StringRef S);
- /// Set the section prefix for this global object.
+ /// Set the section prefix for this global object. If \p Prefix is empty,
+ /// the section prefix metadata will be cleared if it exists.
LLVM_ABI void setSectionPrefix(StringRef Prefix);
+ /// If \p Prefix is different from existing prefix, update section prefix.
+ /// Returns true if an update happens and false otherwise.
+ LLVM_ABI bool updateSectionPrefix(StringRef Prefix);
----------------
snehasish wrote:
Since updateSectionPrefix calls setSectionPrefix and empty string will drop the metadata here too. I wonder if it's worth noting.
https://github.com/llvm/llvm-project/pull/158460
More information about the llvm-commits
mailing list