aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@fb.com>2020-02-28 15:25:47 -0800
committerGreg Clayton <gclayton@fb.com>2020-02-28 17:21:43 -0800
commitd334ce0b5acb945d6202d0ab6a17bdca530f50c1 (patch)
tree640dec8313d74217b1d27e6cb659657b5fe3c823
parent9fcd212e2f678fdbdf304399a1e58ca490dc54d1 (diff)
downloadllvm-d334ce0b5acb945d6202d0ab6a17bdca530f50c1.zip
llvm-d334ce0b5acb945d6202d0ab6a17bdca530f50c1.tar.gz
llvm-d334ce0b5acb945d6202d0ab6a17bdca530f50c1.tar.bz2
Fix GSYM tests to run the yaml files and fix test failures on some machines.
Summary: 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. Reviewers: aprantl, thakis, MaskRay, aadsm, wallace Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D75390
-rw-r--r--llvm/test/tools/llvm-gsymutil/lit.local.cfg1
-rw-r--r--llvm/tools/llvm-gsym/llvm-gsymutil.cpp9
2 files changed, 7 insertions, 3 deletions
diff --git a/llvm/test/tools/llvm-gsymutil/lit.local.cfg b/llvm/test/tools/llvm-gsymutil/lit.local.cfg
new file mode 100644
index 0000000..db82cc2
--- /dev/null
+++ b/llvm/test/tools/llvm-gsymutil/lit.local.cfg
@@ -0,0 +1 @@
+config.suffixes = ['.test', '.yaml']
diff --git a/llvm/tools/llvm-gsym/llvm-gsymutil.cpp b/llvm/tools/llvm-gsym/llvm-gsymutil.cpp
index c7d6cf3..a3be9e3 100644
--- a/llvm/tools/llvm-gsym/llvm-gsymutil.cpp
+++ b/llvm/tools/llvm-gsym/llvm-gsymutil.cpp
@@ -179,7 +179,8 @@ static bool filterArch(MachOObjectFile &Obj) {
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 @@ static llvm::Error handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
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 @@ static llvm::Error handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
// 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