Skip to content

Commit 310e995

Browse files
committed
Add implementaion of overloaded versions of getAttributeValue, getAttributeString in ELFAttrParserExtended that do not take StringRef
with assertion in case they are being used by mistake.
1 parent 99cf9b3 commit 310e995

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

llvm/include/llvm/Support/ELFAttrParserExtended.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ class ELFExtendedAttrParser : public ELFAttributeParser {
3737
public:
3838
Error parse(ArrayRef<uint8_t> Section, llvm::endianness Endian) override;
3939

40+
std::optional<unsigned> getAttributeValue(unsigned Tag) const override;
4041
std::optional<unsigned> getAttributeValue(StringRef BuildAttrSubsectionName,
4142
unsigned Tag) const override;
43+
std::optional<StringRef> getAttributeString(unsigned Tag) const override;
4244
std::optional<StringRef> getAttributeString(StringRef BuildAttrSubsectionName,
4345
unsigned Tag) const override;
4446

llvm/lib/Support/ELFAttrParserExtended.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
using namespace llvm;
2222
using namespace ELFAttrs;
2323

24+
std::optional<unsigned>
25+
ELFExtendedAttrParser::getAttributeValue(unsigned Tag) const {
26+
assert(
27+
0 &&
28+
"use getAttributeValue overloaded version accepting Stringref, unsigned");
29+
return std::nullopt;
30+
}
31+
2432
std::optional<unsigned>
2533
ELFExtendedAttrParser::getAttributeValue(StringRef BuildAttrSubsectionName,
2634
unsigned Tag) const {
@@ -34,6 +42,14 @@ ELFExtendedAttrParser::getAttributeValue(StringRef BuildAttrSubsectionName,
3442
return std::nullopt;
3543
}
3644

45+
std::optional<StringRef>
46+
ELFExtendedAttrParser::getAttributeString(unsigned Tag) const {
47+
assert(
48+
0 &&
49+
"use getAttributeValue overloaded version accepting Stringref, unsigned");
50+
return std::nullopt;
51+
}
52+
3753
std::optional<StringRef>
3854
ELFExtendedAttrParser::getAttributeString(StringRef BuildAttrSubsectionName,
3955
unsigned Tag) const {

0 commit comments

Comments
 (0)