From ab50317e96e57dee5b3ff4ad3f16f205b2a3359e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 24 Jan 2024 20:17:23 +0100 Subject: Merge llvm-project main llvmorg-18-init-18359-g93248729cfae This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvm-project main llvmorg-18-init-18359-g93248729cfae, the last commit before the upstream release/18.x branch was created. PR: 276104 MFC after: 1 month (cherry picked from commit 7a6dacaca14b62ca4b74406814becb87a3fefac0) --- contrib/llvm-project/llvm/lib/Support/StringRef.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'contrib/llvm-project/llvm/lib/Support/StringRef.cpp') diff --git a/contrib/llvm-project/llvm/lib/Support/StringRef.cpp b/contrib/llvm-project/llvm/lib/Support/StringRef.cpp index feee47ca693b..945ae378eb91 100644 --- a/contrib/llvm-project/llvm/lib/Support/StringRef.cpp +++ b/contrib/llvm-project/llvm/lib/Support/StringRef.cpp @@ -388,20 +388,14 @@ static unsigned GetAutoSenseRadix(StringRef &Str) { if (Str.empty()) return 10; - if (Str.starts_with("0x") || Str.starts_with("0X")) { - Str = Str.substr(2); + if (Str.consume_front_insensitive("0x")) return 16; - } - if (Str.starts_with("0b") || Str.starts_with("0B")) { - Str = Str.substr(2); + if (Str.consume_front_insensitive("0b")) return 2; - } - if (Str.starts_with("0o")) { - Str = Str.substr(2); + if (Str.consume_front("0o")) return 8; - } if (Str[0] == '0' && Str.size() > 1 && isDigit(Str[1])) { Str = Str.substr(1); @@ -523,8 +517,7 @@ bool StringRef::consumeInteger(unsigned Radix, APInt &Result) { // Skip leading zeroes. This can be a significant improvement if // it means we don't need > 64 bits. - while (!Str.empty() && Str.front() == '0') - Str = Str.substr(1); + Str = Str.ltrim('0'); // If it was nothing but zeroes.... if (Str.empty()) { -- cgit v1.2.3