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

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 26 19:02:47 PDT 2020


aprantl added inline comments.


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp:333
+
+  // When we generate debug info we add template parameters to names.
+  // Since we don't add a space between the name and the template parameter in
----------------
"we" is super ambiguous. This is LLDB, so you may want to say `Clang` and/or `GCC` does this.


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp:339
+  //
+  // In some cases we with then parse incorrectly. This fixes the issue by
+  // detecting this case and inserting tok::less in place of tok::lessless
----------------
`we with then`


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp:343
+  if (token.getKind() == tok::lessless) {
+    // Make sure we have more tokens before attempting to look ahead one more
+    if (m_next_token_index + 1 < m_tokens.size()) {
----------------
`.`


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp:345
+    if (m_next_token_index + 1 < m_tokens.size()) {
+      // Look ahead two tokens
+      clang::Token n_token = m_tokens[m_next_token_index + 1];
----------------
`.`


================
Comment at: lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp:347
+      clang::Token n_token = m_tokens[m_next_token_index + 1];
+      // If we find ( or < then this is indeed operator<< no need for fix
+      if (n_token.getKind() != tok::l_paren && n_token.getKind() != tok::less) {
----------------
`.`


================
Comment at: lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp:147
+       "`anonymous namespace'::S::<<::__l2", "Foo"},
+      // These cases are idiosyncratic to how we generate debug info for names
+      // when we have template parameters. They are not valid C++ names but if
----------------
... `how Clang generates debug info`?


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

https://reviews.llvm.org/D76168





More information about the lldb-commits mailing list