[Lldb-commits] [lldb] r324380 - More correct handling of error cases C++ name parser

Eugene Zemtsov via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 6 11:04:12 PST 2018


Author: eugene
Date: Tue Feb  6 11:04:12 2018
New Revision: 324380

URL: http://llvm.org/viewvc/llvm-project?rev=324380&view=rev
Log:
More correct handling of error cases C++ name parser

Now incorrect type argument that looks like T<A><B> doesn't
cause an assert, but just a parsing error.

Bug: 36224
Differential Revision: https://reviews.llvm.org/D42939

Modified:
    lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
    lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp?rev=324380&r1=324379&r2=324380&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp Tue Feb  6 11:04:12 2018
@@ -242,8 +242,7 @@ bool CPlusPlusNameParser::ConsumeTemplat
     }
   }
 
-  assert(template_counter >= 0);
-  if (template_counter > 0) {
+  if (template_counter != 0) {
     return false;
   }
   start_position.Remove();

Modified: lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp?rev=324380&r1=324379&r2=324380&view=diff
==============================================================================
--- lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp (original)
+++ lldb/trunk/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp Tue Feb  6 11:04:12 2018
@@ -160,4 +160,6 @@ TEST(CPlusPlusLanguage, ExtractContextAn
       "selector:otherField:", context, basename));
   EXPECT_FALSE(CPlusPlusLanguage::ExtractContextAndIdentifier(
       "abc::", context, basename));
+  EXPECT_FALSE(CPlusPlusLanguage::ExtractContextAndIdentifier(
+      "f<A<B><C>>", context, basename));
 }




More information about the lldb-commits mailing list