[llvm] r348630 - [llvm-tapi] Don't try to override SequenceTraits for std::string

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 7 11:29:01 PST 2018


Author: sbc
Date: Fri Dec  7 11:29:00 2018
New Revision: 348630

URL: http://llvm.org/viewvc/llvm-project?rev=348630&view=rev
Log:
[llvm-tapi] Don't try to override SequenceTraits for std::string

For some reason this doesn't seem to work with LLVM_LINK_LLVM_DYLIB
build.

See https://logs.chromium.org/logs/chromium/bb/client.wasm.llvm/linux/37764/+/recipes/steps/LLVM_regression_tests/0/stdout

What is more it seems that overriding these traits for core types
(including std::string) is not supported/recommend by YAMLTraits.h.
See line 1918 which has the assertion:
 "only use LLVM_YAML_IS_SEQUENCE_VECTOR for types you control"

Differential Revision: https://reviews.llvm.org/D55381

Modified:
    llvm/trunk/lib/TextAPI/ELF/TBEHandler.cpp
    llvm/trunk/unittests/TextAPI/ELFYAMLTest.cpp

Modified: llvm/trunk/lib/TextAPI/ELF/TBEHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TextAPI/ELF/TBEHandler.cpp?rev=348630&r1=348629&r2=348630&view=diff
==============================================================================
--- llvm/trunk/lib/TextAPI/ELF/TBEHandler.cpp (original)
+++ llvm/trunk/lib/TextAPI/ELF/TBEHandler.cpp Fri Dec  7 11:29:00 2018
@@ -126,23 +126,6 @@ template <> struct CustomMappingTraits<s
   }
 };
 
-/// 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 std::string &element(IO &IO, std::vector<std::string> &List,
-                              size_t Index) {
-    if (Index >= List.size())
-      List.resize(Index + 1);
-    return List[Index];
-  }
-
-  // Compacts list of needed libraries into a single line.
-  static const bool flow = true;
-};
-
 /// YAML traits for ELFStub objects.
 template <> struct MappingTraits<ELFStub> {
   static void mapping(IO &IO, ELFStub &Stub) {

Modified: llvm/trunk/unittests/TextAPI/ELFYAMLTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/TextAPI/ELFYAMLTest.cpp?rev=348630&r1=348629&r2=348630&view=diff
==============================================================================
--- llvm/trunk/unittests/TextAPI/ELFYAMLTest.cpp (original)
+++ llvm/trunk/unittests/TextAPI/ELFYAMLTest.cpp Fri Dec  7 11:29:00 2018
@@ -196,7 +196,10 @@ TEST(ElfYamlTextAPI, YAMLWritesNoTBESyms
                           "TbeVersion:      1.0\n"
                           "SoName:          nosyms.so\n"
                           "Arch:            x86_64\n"
-                          "NeededLibs:      [ libc.so, libfoo.so, libbar.so ]\n"
+                          "NeededLibs:      \n"
+                          "  - libc.so\n"
+                          "  - libfoo.so\n"
+                          "  - libbar.so\n"
                           "Symbols:         {}\n"
                           "...\n";
   ELFStub Stub;




More information about the llvm-commits mailing list