Make 'type lookup' print an error message instead of complete radio silence when...
authorEnrico Granata <egranata@apple.com>
Thu, 24 Mar 2016 21:32:39 +0000 (21:32 +0000)
committerEnrico Granata <egranata@apple.com>
Thu, 24 Mar 2016 21:32:39 +0000 (21:32 +0000)
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

llvm-svn: 264343

lldb/packages/Python/lldbsuite/test/functionalities/type_lookup/TestTypeLookup.py
lldb/source/Commands/CommandObjectType.cpp

index 1261983..774eb43 100644 (file)
@@ -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'"])
index f291f11..23e3c0e 100644 (file)
@@ -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;
     }