Index: llvm/lib/Support/FileCollector.cpp =================================================================== --- llvm/lib/Support/FileCollector.cpp +++ llvm/lib/Support/FileCollector.cpp @@ -50,7 +50,9 @@ } FileCollector::FileCollector(std::string Root, std::string OverlayRoot) - : Root(std::move(Root)), OverlayRoot(std::move(OverlayRoot)) { + : Root(Root), OverlayRoot(OverlayRoot) { + assert(sys::path::is_absolute(Root) && "Root not absolute"); + assert(sys::path::is_absolute(OverlayRoot) && "OverlayRoot not absolute"); } void FileCollector::PathCanonicalizer::updateWithRealPath( Index: llvm/test/tools/dsymutil/X86/reproducer.test =================================================================== --- llvm/test/tools/dsymutil/X86/reproducer.test +++ llvm/test/tools/dsymutil/X86/reproducer.test @@ -13,6 +13,9 @@ # Verify all the files are present. RUN: dsymutil -f -o - -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s +# Make sure we don't crash with an empty TMPDIR. +RUN: env TMPDIR="" dsymutil -o -f %t.generate -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 + # Create a reproducer. RUN: env DSYMUTIL_REPRODUCER_PATH=%t.repro dsymutil -gen-reproducer -f -o %t.generate -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefixes=REPRODUCER RUN: llvm-dwarfdump -a %t.generate | FileCheck %s Index: llvm/tools/dsymutil/Reproducer.cpp =================================================================== --- llvm/tools/dsymutil/Reproducer.cpp +++ llvm/tools/dsymutil/Reproducer.cpp @@ -20,6 +20,7 @@ } else { EC = sys::fs::createUniqueDirectory("dsymutil", Root); } + sys::fs::make_absolute(Root); return EC ? "" : std::string(Root); }