[Lldb-commits] [PATCH] D76168: CPlusPlusNameParser does not handles templated operator< properly

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 20 09:44:42 PDT 2020


aprantl added inline comments.


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp:333
+  if (token.getKind() == tok::lessless) {
+    if (m_next_token_index + 1 < m_tokens.size()) {
+      clang::Token n_token = m_tokens[m_next_token_index + 1];
----------------
Add a comment what this block is doing?


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp:334
+    if (m_next_token_index + 1 < m_tokens.size()) {
+      clang::Token n_token = m_tokens[m_next_token_index + 1];
+      if (n_token.getKind() != tok::l_paren && n_token.getKind() != tok::less) {
----------------
Thinking out loud: This is looking ahead two tokens.


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp:342
+
+        m_tokens[m_next_token_index] = tmp_tok;
+
----------------
here we are pushing an artificial less token, but it's not obvious why what works, so if you could add a comment explaining what is going on here, that would help.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76168/new/

https://reviews.llvm.org/D76168





More information about the lldb-commits mailing list