diff options
author | Armando Montanez <amontanez@google.com> | 2018-12-07 01:31:28 +0000 |
---|---|---|
committer | Armando Montanez <amontanez@google.com> | 2018-12-07 01:31:28 +0000 |
commit | c9488e4d8957131862977b01eebe283eea8d442b (patch) | |
tree | 9113e7d700d57184aa40c46ef654810feb710f1b /llvm/lib/TextAPI/ELF/TBEHandler.cpp | |
parent | 29ae65946a10436e038349d40955346a52de1632 (diff) | |
download | bcm5719-llvm-c9488e4d8957131862977b01eebe283eea8d442b.tar.gz bcm5719-llvm-c9488e4d8957131862977b01eebe283eea8d442b.zip |
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.
llvm-svn: 348560
Diffstat (limited to 'llvm/lib/TextAPI/ELF/TBEHandler.cpp')
-rw-r--r-- | llvm/lib/TextAPI/ELF/TBEHandler.cpp | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/llvm/lib/TextAPI/ELF/TBEHandler.cpp b/llvm/lib/TextAPI/ELF/TBEHandler.cpp index 59c61c38070..a3216663729 100644 --- a/llvm/lib/TextAPI/ELF/TBEHandler.cpp +++ b/llvm/lib/TextAPI/ELF/TBEHandler.cpp @@ -18,8 +18,6 @@ using namespace llvm; using namespace llvm::elfabi; LLVM_YAML_STRONG_TYPEDEF(ELFArch, ELFArchMapper) -LLVM_YAML_STRONG_TYPEDEF(std::string, ELFNeededEntry) -LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(ELFNeededEntry) namespace llvm { namespace yaml { @@ -128,23 +126,21 @@ template <> struct CustomMappingTraits<std::set<ELFSymbol>> { } }; -/// YAML traits for ELFNeededEntry. This is required to enable flow mapping on -/// NeededLibs. -template <> struct ScalarTraits<ELFNeededEntry> { - static void output(const ELFNeededEntry &Value, void *, - llvm::raw_ostream &Out) { - Out << Value.value; +/// YAML traits for generic string vectors (i.e. list of needed libraries). +template <> struct SequenceTraits<std::vector<std::string>> { + static size_t size(IO &IO, std::vector<std::string> &List) { + return List.size(); } - static StringRef input(StringRef Scalar, void *, ELFNeededEntry &Value) { - Value = Scalar.str(); - - // Returning empty StringRef indicates successful parse. - return StringRef(); + static std::string &element(IO &IO, std::vector<std::string> &List, + size_t Index) { + if (Index >= List.size()) + List.resize(Index + 1); + return List[Index]; } - // Don't place quotation marks around needed entries. - static QuotingType mustQuote(StringRef) { return QuotingType::None; } + // Compacts list of needed libraries into a single line. + static const bool flow = true; }; /// YAML traits for ELFStub objects. @@ -155,8 +151,7 @@ template <> struct MappingTraits<ELFStub> { IO.mapRequired("TbeVersion", Stub.TbeVersion); IO.mapRequired("SoName", Stub.SoName); IO.mapRequired("Arch", (ELFArchMapper &)Stub.Arch); - IO.mapOptional("NeededLibs", - (std::vector<ELFNeededEntry> &)Stub.NeededLibs); + IO.mapOptional("NeededLibs", Stub.NeededLibs); IO.mapRequired("Symbols", Stub.Symbols); } }; |