Skip to content

Commit d334ce0

Browse files
committed
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
1 parent 9fcd212 commit d334ce0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
config.suffixes = ['.test', '.yaml']

llvm/tools/llvm-gsym/llvm-gsymutil.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ static bool filterArch(MachOObjectFile &Obj) {
179179
if (ArchFilters.empty())
180180
return true;
181181

182-
StringRef ObjArch = Obj.getArchTriple().getArchName();
182+
Triple ObjTriple(Obj.getArchTriple());
183+
StringRef ObjArch = ObjTriple.getArchName();
183184

184185
for (auto Arch : ArchFilters) {
185186
// Match name.
@@ -350,7 +351,8 @@ static llvm::Error handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
350351
error(Filename, errorToErrorCode(BinOrErr.takeError()));
351352

352353
if (auto *Obj = dyn_cast<ObjectFile>(BinOrErr->get())) {
353-
auto ArchName = Obj->makeTriple().getArchName();
354+
Triple ObjTriple(Obj->makeTriple());
355+
auto ArchName = ObjTriple.getArchName();
354356
outs() << "Output file (" << ArchName << "): " << OutFile << "\n";
355357
if (auto Err = handleObjectFile(*Obj, OutFile.c_str()))
356358
return Err;
@@ -374,7 +376,8 @@ static llvm::Error handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
374376

375377
// Now handle each architecture we need to convert.
376378
for (auto &Obj: FilterObjs) {
377-
auto ArchName = Obj->getArchTriple().getArchName();
379+
Triple ObjTriple(Obj->getArchTriple());
380+
auto ArchName = ObjTriple.getArchName();
378381
std::string ArchOutFile(OutFile);
379382
// If we are only handling a single architecture, then we will use the
380383
// normal output file. If we are handling multiple architectures append

0 commit comments

Comments
 (0)