[Lldb-commits] [lldb] r264343 - Make 'type lookup' print an error message instead of complete radio silence when it can't find a type matching user input
    Enrico Granata via lldb-commits 
    lldb-commits at lists.llvm.org
       
    Thu Mar 24 14:32:39 PDT 2016
    
    
  
Author: enrico
Date: Thu Mar 24 16:32:39 2016
New Revision: 264343
URL: http://llvm.org/viewvc/llvm-project?rev=264343&view=rev
Log:
Make 'type lookup' print an error message instead of complete radio silence when it can't find a type matching user input
It would be fun to make it provide suggestions (e.g. 'can't find NString, did you mean NSString instead?'), but this worries me a little bit on the account of just how thorough of a type system scan it would have to do
Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
    lldb/trunk/source/Commands/CommandObjectType.cpp
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py?rev=264343&r1=264342&r2=264343&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py Thu Mar 24 16:32:39 2016
@@ -42,3 +42,4 @@ class TypeLookupTestCase(TestBase):
         self.expect('type lookup NSURL', substrs=['NSURL'])
         self.expect('type lookup NSArray', substrs=['NSArray'])
         self.expect('type lookup NSObject', substrs=['NSObject', 'isa'])
+        self.expect('type lookup PleaseDontBeARealTypeThatExists', substrs=["no type was found matching 'PleaseDontBeARealTypeThatExists'"])
Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=264343&r1=264342&r2=264343&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Thu Mar 24 16:32:39 2016
@@ -3404,6 +3404,9 @@ public:
             }
         }
         
+        if (!any_found)
+            result.AppendMessageWithFormat("no type was found matching '%s'\n", name_of_type);
+        
         result.SetStatus (any_found ? lldb::eReturnStatusSuccessFinishResult : lldb::eReturnStatusSuccessFinishNoResult);
         return true;
     }
    
    
More information about the lldb-commits
mailing list