[llvm] r198928 - lli: LLIObjectCache: Use llvm::sys::path to get dirname.
NAKAMURA Takumi
geek4civic at gmail.com
Fri Jan 10 02:38:34 PST 2014
Author: chapuni
Date: Fri Jan 10 04:38:34 2014
New Revision: 198928
URL: http://llvm.org/viewvc/llvm-project?rev=198928&view=rev
Log:
lli: LLIObjectCache: Use llvm::sys::path to get dirname.
Modified:
llvm/trunk/tools/lli/lli.cpp
Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=198928&r1=198927&r2=198928&view=diff
==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Fri Jan 10 04:38:34 2014
@@ -268,8 +268,11 @@ public:
if (!getCacheFilename(ModuleID, CacheName))
return;
std::string errStr;
- if (!CacheDir.empty()) // Create user-defined cache dir.
- sys::fs::create_directories(CacheName.substr(0, CacheName.rfind('/')));
+ if (!CacheDir.empty()) { // Create user-defined cache dir.
+ SmallString<128> dir(CacheName);
+ sys::path::remove_filename(dir);
+ sys::fs::create_directories(Twine(dir));
+ }
raw_fd_ostream outfile(CacheName.c_str(), errStr, sys::fs::F_Binary);
outfile.write(Obj->getBufferStart(), Obj->getBufferSize());
outfile.close();
More information about the llvm-commits
mailing list