Skip to content

Commit

Permalink
Make the size specification for cache_size_bytes case insensitive.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306129 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
pcc committed Jun 23, 2017
1 parent 5cc49a2 commit 5974d48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Support/CachePruning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ llvm::parseCachePruningPolicy(StringRef PolicyStr) {
Policy.MaxSizePercentageOfAvailableSpace = Size;
} else if (Key == "cache_size_bytes") {
uint64_t Mult = 1;
switch (Value.back()) {
switch (tolower(Value.back())) {
case 'k':
Mult = 1024;
Value = Value.drop_back();
Expand Down
2 changes: 1 addition & 1 deletion unittests/Support/CachePruningTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TEST(CachePruningPolicyParser, MaxSizeBytes) {
ASSERT_TRUE(bool(P));
EXPECT_EQ(75u, P->MaxSizePercentageOfAvailableSpace);
EXPECT_EQ(3u * 1024u * 1024u, P->MaxSizeBytes);
P = parseCachePruningPolicy("cache_size_bytes=4g");
P = parseCachePruningPolicy("cache_size_bytes=4G");
ASSERT_TRUE(bool(P));
EXPECT_EQ(75u, P->MaxSizePercentageOfAvailableSpace);
EXPECT_EQ(4ull * 1024ull * 1024ull * 1024ull, P->MaxSizeBytes);
Expand Down

0 comments on commit 5974d48

Please sign in to comment.