[PATCH] D75390: Fix GSYM tests to run the yaml files and fix test failures on some machines.

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 15:30:48 PST 2020


clayborg created this revision.
clayborg added reviewers: aprantl, thakis, MaskRay, aadsm, wallace.
Herald added a project: LLVM.

YAML files were not being run during lit testing as there was no lit.local.cfg file. Once this was fixed, some buildbots would fail due to a StringRef that pointed to a std::string inside of a temporary llvm::Triple object. These issues are fixed here by making a local triple object that stays around long enough so the StringRef points to valid data.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75390

Files:
  llvm/test/tools/llvm-gsymutil/lit.local.cfg
  llvm/tools/llvm-gsym/llvm-gsymutil.cpp


Index: llvm/tools/llvm-gsym/llvm-gsymutil.cpp
===================================================================
--- llvm/tools/llvm-gsym/llvm-gsymutil.cpp
+++ llvm/tools/llvm-gsym/llvm-gsymutil.cpp
@@ -179,7 +179,8 @@
   if (ArchFilters.empty())
     return true;
 
-  StringRef ObjArch = Obj.getArchTriple().getArchName();
+  Triple ObjTriple(Obj.getArchTriple());
+  StringRef ObjArch = ObjTriple.getArchName();
 
   for (auto Arch : ArchFilters) {
     // Match name.
@@ -350,7 +351,8 @@
   error(Filename, errorToErrorCode(BinOrErr.takeError()));
 
   if (auto *Obj = dyn_cast<ObjectFile>(BinOrErr->get())) {
-    auto ArchName = Obj->makeTriple().getArchName();
+    Triple ObjTriple(Obj->makeTriple());
+    auto ArchName = ObjTriple.getArchName();
     outs() << "Output file (" << ArchName << "): " << OutFile << "\n";
     if (auto Err = handleObjectFile(*Obj, OutFile.c_str()))
       return Err;
@@ -374,7 +376,8 @@
 
     // Now handle each architecture we need to convert.
     for (auto &Obj: FilterObjs) {
-      auto ArchName = Obj->getArchTriple().getArchName();
+      Triple ObjTriple(Obj->getArchTriple());
+      auto ArchName = ObjTriple.getArchName();
       std::string ArchOutFile(OutFile);
       // If we are only handling a single architecture, then we will use the
       // normal output file. If we are handling multiple architectures append
Index: llvm/test/tools/llvm-gsymutil/lit.local.cfg
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-gsymutil/lit.local.cfg
@@ -0,0 +1 @@
+config.suffixes = ['.test', '.yaml']


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75390.247378.patch
Type: text/x-patch
Size: 1608 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200228/ae84823a/attachment.bin>


More information about the llvm-commits mailing list