[Lldb-commits] [lldb] [lldb][ObjC][NFCI] Replace StringLexer with llvm::StringRef (PR #172466)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 17 03:39:09 PST 2025


================
@@ -15,13 +15,29 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
-#include "lldb/Utility/StringLexer.h"
 
 #include "clang/Basic/TargetInfo.h"
 
 #include <optional>
 #include <vector>
 
+static char popChar(llvm::StringRef &str) {
+  const char c = str.front();
+
+  str = str.drop_front();
+
+  return c;
+}
+
+static bool consumeChar(llvm::StringRef &str, char c) {
----------------
Michael137 wrote:

It doesn't work for `char` unfortunately. You have to pass it a string literal. We can't get away with the string literal because we need to consume a `char` lvalue. We could add a `llvm::StringRef::consume_front` should have a `char` overload, but until then I'm pretty sure we need this helper

https://github.com/llvm/llvm-project/pull/172466


More information about the lldb-commits mailing list