Modernize Module::RemapFile to return an Optional (NFC)

This addresses feedback raised in https://reviews.llvm.org/D104404.

Differential Revision: https://reviews.llvm.org/D104724
This commit is contained in:
Adrian Prantl
2021-06-29 15:19:31 -07:00
parent 302b1b9718
commit a0e1b11fac
3 changed files with 14 additions and 18 deletions

View File

@@ -1605,14 +1605,11 @@ bool Module::FindSourceFile(const FileSpec &orig_spec,
return false;
}
bool Module::RemapSourceFile(llvm::StringRef path,
std::string &new_path) const {
llvm::Optional<std::string> Module::RemapSourceFile(llvm::StringRef path) const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (auto remapped = m_source_mappings.RemapPath(path)) {
new_path = remapped->GetPath();
return true;
}
return false;
if (auto remapped = m_source_mappings.RemapPath(path))
return remapped->GetPath();
return {};
}
void Module::RegisterXcodeSDK(llvm::StringRef sdk_name, llvm::StringRef sysroot) {