Skip to content

Commit 3bf9e63

Browse files
[lli] Use StringRef::consume_front (NFC)
1 parent 4460fa8 commit 3bf9e63

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/tools/lli/lli.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,13 +347,11 @@ class LLIObjectCache : public ObjectCache {
347347
private:
348348
std::string CacheDir;
349349

350-
bool getCacheFilename(const std::string &ModID, std::string &CacheName) {
351-
std::string Prefix("file:");
352-
size_t PrefixLength = Prefix.length();
353-
if (ModID.substr(0, PrefixLength) != Prefix)
350+
bool getCacheFilename(StringRef ModID, std::string &CacheName) {
351+
if (!ModID.consume_front("file:"))
354352
return false;
355353

356-
std::string CacheSubdir = ModID.substr(PrefixLength);
354+
std::string CacheSubdir = std::string(ModID);
357355
// Transform "X:\foo" => "/X\foo" for convenience on Windows.
358356
if (is_style_windows(llvm::sys::path::Style::native) &&
359357
isalpha(CacheSubdir[0]) && CacheSubdir[1] == ':') {

0 commit comments

Comments
 (0)