[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
Fri Feb 28 05:11:48 PST 2025


================
@@ -43,6 +44,18 @@ class Token {
 
   bool IsOneOf(Kind kind1, Kind kind2) const { return Is(kind1) || Is(kind2); }
 
+  bool IsOneOf(std::vector<Kind> kinds) const {
+    if (kinds.empty())
+      return false;
+
+    if (kinds.size() == 1)
+      return Is(kinds[0]);
+
+    Kind k = kinds.back();
+    kinds.pop_back();
+    return Is(k) || IsOneOf(kinds);
+  }
+
   template <typename... Ts> bool IsOneOf(Kind kind, Ts... Ks) const {
     return Is(kind) || IsOneOf(Ks...);
   }
----------------
labath wrote:

```suggestion
  bool IsOneOf(llvm::ArrayRef<Kind> kinds) const {
    return llvm::is_contained(kinds, m_kind);
  }
```


you should be able to call it as `IsOneOf({Kind1, Kind2});

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


More information about the lldb-commits mailing list