Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/tools/lli/lli.cpp
Show First 20 Lines • Show All 349 Lines • ▼ Show 20 Lines | private: | ||||
bool getCacheFilename(const std::string &ModID, std::string &CacheName) { | bool getCacheFilename(const std::string &ModID, std::string &CacheName) { | ||||
std::string Prefix("file:"); | std::string Prefix("file:"); | ||||
size_t PrefixLength = Prefix.length(); | size_t PrefixLength = Prefix.length(); | ||||
if (ModID.substr(0, PrefixLength) != Prefix) | if (ModID.substr(0, PrefixLength) != Prefix) | ||||
return false; | return false; | ||||
std::string CacheSubdir = ModID.substr(PrefixLength); | std::string CacheSubdir = ModID.substr(PrefixLength); | ||||
#if defined(_WIN32) | // Transform "X:\foo" => "/X\foo" for convenience on Windows. | ||||
// Transform "X:\foo" => "/X\foo" for convenience. | if (is_style_windows(llvm::sys::path::Style::native) && | ||||
if (isalpha(CacheSubdir[0]) && CacheSubdir[1] == ':') { | isalpha(CacheSubdir[0]) && CacheSubdir[1] == ':') { | ||||
CacheSubdir[1] = CacheSubdir[0]; | CacheSubdir[1] = CacheSubdir[0]; | ||||
CacheSubdir[0] = '/'; | CacheSubdir[0] = '/'; | ||||
} | } | ||||
#endif | |||||
CacheName = CacheDir + CacheSubdir; | CacheName = CacheDir + CacheSubdir; | ||||
size_t pos = CacheName.rfind('.'); | size_t pos = CacheName.rfind('.'); | ||||
CacheName.replace(pos, CacheName.length() - pos, ".o"); | CacheName.replace(pos, CacheName.length() - pos, ".o"); | ||||
return true; | return true; | ||||
} | } | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 784 Lines • Show Last 20 Lines |