[Lldb-commits] [lldb] [LLDB] Add DIL code for handling plain variable names. (PR #120971)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 26 02:22:06 PST 2024


================
@@ -0,0 +1,191 @@
+//===-- DILLexer.cpp ------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+// This implements the recursive descent parser for the Data Inspection
+// Language (DIL), and its helper functions, which will eventually underlie the
+// 'frame variable' command. The language that this parser recognizes is
+// described in lldb/docs/dil-expr-lang.ebnf
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/ValueObject/DILLexer.h"
+
+namespace lldb_private {
+
+namespace dil {
+
+const std::string DILToken::getTokenName(dil::TokenKind kind) {
+  std::string retval;
+  switch (kind) {
+  case dil::TokenKind::coloncolon:
+    retval = "coloncolon";
+    break;
+  case dil::TokenKind::eof:
+    retval = "eof";
+    break;
----------------
labath wrote:

```suggestion
llvm::StringRef DILToken::getTokenName(dil::TokenKind kind) {
  switch (kind) {
  case dil::TokenKind::coloncolon:
    return "coloncolon";
  case dil::TokenKind::eof:
    return "eof";
...
```

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


More information about the lldb-commits mailing list