Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 2b0c69e

Browse files
Revert "[llvm-tapi] Don't override SequenceTraits for std::string"
Revert r348551 since it triggered some warnings that don't appear to have a quick fix. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348560 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 0ac91b6 commit 2b0c69e

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

lib/TextAPI/ELF/TBEHandler.cpp

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ using namespace llvm;
1818
using namespace llvm::elfabi;
1919

2020
LLVM_YAML_STRONG_TYPEDEF(ELFArch, ELFArchMapper)
21-
LLVM_YAML_STRONG_TYPEDEF(std::string, ELFNeededEntry)
22-
LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(ELFNeededEntry)
2321

2422
namespace llvm {
2523
namespace yaml {
@@ -128,23 +126,21 @@ template <> struct CustomMappingTraits<std::set<ELFSymbol>> {
128126
}
129127
};
130128

131-
/// YAML traits for ELFNeededEntry. This is required to enable flow mapping on
132-
/// NeededLibs.
133-
template <> struct ScalarTraits<ELFNeededEntry> {
134-
static void output(const ELFNeededEntry &Value, void *,
135-
llvm::raw_ostream &Out) {
136-
Out << Value.value;
129+
/// YAML traits for generic string vectors (i.e. list of needed libraries).
130+
template <> struct SequenceTraits<std::vector<std::string>> {
131+
static size_t size(IO &IO, std::vector<std::string> &List) {
132+
return List.size();
137133
}
138134

139-
static StringRef input(StringRef Scalar, void *, ELFNeededEntry &Value) {
140-
Value = Scalar.str();
141-
142-
// Returning empty StringRef indicates successful parse.
143-
return StringRef();
135+
static std::string &element(IO &IO, std::vector<std::string> &List,
136+
size_t Index) {
137+
if (Index >= List.size())
138+
List.resize(Index + 1);
139+
return List[Index];
144140
}
145141

146-
// Don't place quotation marks around needed entries.
147-
static QuotingType mustQuote(StringRef) { return QuotingType::None; }
142+
// Compacts list of needed libraries into a single line.
143+
static const bool flow = true;
148144
};
149145

150146
/// YAML traits for ELFStub objects.
@@ -155,8 +151,7 @@ template <> struct MappingTraits<ELFStub> {
155151
IO.mapRequired("TbeVersion", Stub.TbeVersion);
156152
IO.mapRequired("SoName", Stub.SoName);
157153
IO.mapRequired("Arch", (ELFArchMapper &)Stub.Arch);
158-
IO.mapOptional("NeededLibs",
159-
(std::vector<ELFNeededEntry> &)Stub.NeededLibs);
154+
IO.mapOptional("NeededLibs", Stub.NeededLibs);
160155
IO.mapRequired("Symbols", Stub.Symbols);
161156
}
162157
};

0 commit comments

Comments
 (0)