[Lldb-commits] [lldb] [LLDB] Update DIL to pass current 'frame var' tests. (PR #145055)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 23 02:30:07 PDT 2025


================
@@ -178,11 +178,40 @@ ASTNodeUP DILParser::ParsePrimaryExpression() {
   }
 
   if (CurToken().Is(Token::l_paren)) {
-    m_dil_lexer.Advance();
-    auto expr = ParseExpression();
-    Expect(Token::r_paren);
-    m_dil_lexer.Advance();
-    return expr;
+    // Check in case this is an anonynmous namespace
+    if (m_dil_lexer.LookAhead(1).Is(Token::identifier) &&
+        (m_dil_lexer.LookAhead(1).GetSpelling() == "anonymous") &&
+        m_dil_lexer.LookAhead(2).Is(Token::identifier) &&
+        (m_dil_lexer.LookAhead(2).GetSpelling() == "namespace") &&
+        m_dil_lexer.LookAhead(3).Is(Token::r_paren) &&
+        m_dil_lexer.LookAhead(4).Is(Token::coloncolon)) {
+      m_dil_lexer.Advance(4);
+
+      std::string identifier = "(anonymous namespace)";
----------------
labath wrote:

Instead of basically inlining a part of ParseIdExpression, could we find a way to delegate to it? What would happen if we changed the check on line 172 to say "if next token is :: or identifier *OR* next 4 tokens are '(anonymous namespace)'" ?

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


More information about the lldb-commits mailing list