summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TextAPI/ELF/TBEHandler.cpp
diff options
context:
space:
mode:
authorArmando Montanez <amontanez@google.com>2018-12-06 23:59:32 +0000
committerArmando Montanez <amontanez@google.com>2018-12-06 23:59:32 +0000
commit8c1cd213b7f76f6b567ba91c8faaca8e98a63f12 (patch)
treedd572c3a6724c2a3beb927af0b7049dc7c2397fc /llvm/lib/TextAPI/ELF/TBEHandler.cpp
parent86cb67985179984da5fc2e8bc97c7f5579bada84 (diff)
downloadbcm5719-llvm-8c1cd213b7f76f6b567ba91c8faaca8e98a63f12.tar.gz
bcm5719-llvm-8c1cd213b7f76f6b567ba91c8faaca8e98a63f12.zip
[llvm-tapi] Don't override SequenceTraits for std::string
Change the ELF YAML implementation of TextAPI so NeededLibs uses flow sequence vector correctly instead of overriding the YAML implementation for std::vector<std::string>>. This should fix the test failure with the LLVM_LINK_LLVM_DYLIB build mentioned in D55381. Still passes existing tests that cover this. Differential Revision: https://reviews.llvm.org/D55390 llvm-svn: 348551
Diffstat (limited to 'llvm/lib/TextAPI/ELF/TBEHandler.cpp')
-rw-r--r--llvm/lib/TextAPI/ELF/TBEHandler.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/llvm/lib/TextAPI/ELF/TBEHandler.cpp b/llvm/lib/TextAPI/ELF/TBEHandler.cpp
index a3216663729..59c61c38070 100644
--- a/llvm/lib/TextAPI/ELF/TBEHandler.cpp
+++ b/llvm/lib/TextAPI/ELF/TBEHandler.cpp
@@ -18,6 +18,8 @@ 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 {
@@ -126,21 +128,23 @@ template <> struct CustomMappingTraits<std::set<ELFSymbol>> {
}
};
-/// 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();
+/// 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;
}
- 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];
+ static StringRef input(StringRef Scalar, void *, ELFNeededEntry &Value) {
+ Value = Scalar.str();
+
+ // Returning empty StringRef indicates successful parse.
+ return StringRef();
}
- // Compacts list of needed libraries into a single line.
- static const bool flow = true;
+ // Don't place quotation marks around needed entries.
+ static QuotingType mustQuote(StringRef) { return QuotingType::None; }
};
/// YAML traits for ELFStub objects.
@@ -151,7 +155,8 @@ template <> struct MappingTraits<ELFStub> {
IO.mapRequired("TbeVersion", Stub.TbeVersion);
IO.mapRequired("SoName", Stub.SoName);
IO.mapRequired("Arch", (ELFArchMapper &)Stub.Arch);
- IO.mapOptional("NeededLibs", Stub.NeededLibs);
+ IO.mapOptional("NeededLibs",
+ (std::vector<ELFNeededEntry> &)Stub.NeededLibs);
IO.mapRequired("Symbols", Stub.Symbols);
}
};
OpenPOWER on IntegriCloud