================
@@ -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)";
+      Expect(Token::coloncolon);
+      // Save the source location for the diagnostics message.
+      uint32_t loc = CurToken().GetLocation();
+      m_dil_lexer.Advance();
+      assert(
+          (CurToken().Is(Token::identifier) || CurToken().Is(Token::l_paren)) 
&&
+          "Expected an identifier or anonymous namespeace, but not found.");
----------------
labath wrote:

An assert is fine for an internal invariant, but this looks like its checking 
the next token in the stream. That's can't be right. Or am I misunderstanding 
something?

https://github.com/llvm/llvm-project/pull/145055
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to