Fix for use-after-free which caused test failure in cuda-detect.cu.
Return std::string itself instead StringRef to a temporary std::string.
llvm-svn: 253410
diff --git a/clang/lib/Driver/ToolChains.h b/clang/lib/Driver/ToolChains.h
index b18739c..2b655f6 100644
--- a/clang/lib/Driver/ToolChains.h
+++ b/clang/lib/Driver/ToolChains.h
@@ -186,7 +186,7 @@
/// \brief Get the detected Cuda device library path.
StringRef getLibDevicePath() const { return CudaLibDevicePath; }
/// \brief Get libdevice file for given architecture
- StringRef getLibDeviceFile(StringRef Gpu) const {
+ std::string getLibDeviceFile(StringRef Gpu) const {
return CudaLibDeviceMap.lookup(Gpu);
}
};