mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 21:26:53 +00:00
[llvm][ELF][build attributes] Change StringRef to std::string for BuildAttributeSubSection::Name (#135625)
BuildAttributeSubSection::Name must be a std::string instead of StringRef because it may be assigned from non-persistent memory. StringRef is non-owning and unsafe in this context. This change ensures the subsection name owns its memory, preventing use-after-free or dangling references. Context: Work in progress in PR #131990.
This commit is contained in:
parent
74e8f29f31
commit
bcbdbd25c0
@ -36,7 +36,7 @@ struct BuildAttributeItem {
|
|||||||
: Type(Ty), Tag(Tg), IntValue(IV), StringValue(std::move(SV)) {}
|
: Type(Ty), Tag(Tg), IntValue(IV), StringValue(std::move(SV)) {}
|
||||||
};
|
};
|
||||||
struct BuildAttributeSubSection {
|
struct BuildAttributeSubSection {
|
||||||
StringRef Name;
|
std::string Name;
|
||||||
unsigned IsOptional;
|
unsigned IsOptional;
|
||||||
unsigned ParameterType;
|
unsigned ParameterType;
|
||||||
SmallVector<BuildAttributeItem, 64> Content;
|
SmallVector<BuildAttributeItem, 64> Content;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user