@@ -18,8 +18,6 @@ using namespace llvm;
1818using namespace llvm ::elfabi;
1919
2020LLVM_YAML_STRONG_TYPEDEF (ELFArch, ELFArchMapper)
21- LLVM_YAML_STRONG_TYPEDEF(std::string, ELFNeededEntry)
22- LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(ELFNeededEntry)
2321
2422namespace llvm {
2523namespace 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