@@ -18,8 +18,6 @@ using namespace llvm;
18
18
using namespace llvm ::elfabi;
19
19
20
20
LLVM_YAML_STRONG_TYPEDEF (ELFArch, ELFArchMapper)
21
- LLVM_YAML_STRONG_TYPEDEF(std::string, ELFNeededEntry)
22
- LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(ELFNeededEntry)
23
21
24
22
namespace llvm {
25
23
namespace yaml {
@@ -128,23 +126,21 @@ template <> struct CustomMappingTraits<std::set<ELFSymbol>> {
128
126
}
129
127
};
130
128
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 ();
137
133
}
138
134
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] ;
144
140
}
145
141
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 ;
148
144
};
149
145
150
146
// / YAML traits for ELFStub objects.
@@ -155,8 +151,7 @@ template <> struct MappingTraits<ELFStub> {
155
151
IO.mapRequired (" TbeVersion" , Stub.TbeVersion );
156
152
IO.mapRequired (" SoName" , Stub.SoName );
157
153
IO.mapRequired (" Arch" , (ELFArchMapper &)Stub.Arch );
158
- IO.mapOptional (" NeededLibs" ,
159
- (std::vector<ELFNeededEntry> &)Stub.NeededLibs );
154
+ IO.mapOptional (" NeededLibs" , Stub.NeededLibs );
160
155
IO.mapRequired (" Symbols" , Stub.Symbols );
161
156
}
162
157
};
0 commit comments