Automatically enabling the Cocoa formatter categories for command-line LLDB. Previously, the categories were filled in but disabled by default. Tweaking test cases appropriately to keep working and do the right thing

llvm-svn: 155605
diff --git a/lldb/examples/summaries/cocoa/NSDate.py b/lldb/examples/summaries/cocoa/NSDate.py
index 082cd19..df13182 100644
--- a/lldb/examples/summaries/cocoa/NSDate.py
+++ b/lldb/examples/summaries/cocoa/NSDate.py
@@ -211,7 +211,7 @@
 		wrapper = NSTimeZoneClass_SummaryProvider(valobj, class_data.sys_params)
 		statistics.metric_hit('code_notrun',valobj)
 	else:
-		wrapper = NSUnknownDate_SummaryProvider(valobj, class_data.sys_params)
+		wrapper = NSUnknownDate_SummaryProvider(valobj)
 		statistics.metric_hit('unknown_class',valobj.GetName() + " seen as " + name_string)
 	return wrapper;
 
diff --git a/lldb/source/Core/FormatManager.cpp b/lldb/source/Core/FormatManager.cpp
index 4576243..ae9aa28 100644
--- a/lldb/source/Core/FormatManager.cpp
+++ b/lldb/source/Core/FormatManager.cpp
@@ -597,13 +597,13 @@
 #endif
     
     EnableCategory(m_objc_category_name,CategoryMap::Last);
-    //EnableCategory(m_corefoundation_category_name,CategoryMap::Last);
-    //EnableCategory(m_appkit_category_name,CategoryMap::Last);
-    //EnableCategory(m_coreservices_category_name,CategoryMap::Last);
-    //EnableCategory(m_coregraphics_category_name,CategoryMap::Last);
+    EnableCategory(m_corefoundation_category_name,CategoryMap::Last);
+    EnableCategory(m_appkit_category_name,CategoryMap::Last);
+    EnableCategory(m_coreservices_category_name,CategoryMap::Last);
+    EnableCategory(m_coregraphics_category_name,CategoryMap::Last);
     EnableCategory(m_gnu_cpp_category_name,CategoryMap::Last);
     EnableCategory(m_libcxx_category_name,CategoryMap::Last);
-    //EnableCategory(m_vectortypes_category_name,CategoryMap::Last);
+    EnableCategory(m_vectortypes_category_name,CategoryMap::Last);
     EnableCategory(m_system_category_name,CategoryMap::Last);
 }
 
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py b/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
index dd93cff..1cccef3 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
@@ -127,17 +127,11 @@
             self.runCmd('type format clear', check=False)
             self.runCmd('type summary clear', check=False)
             self.runCmd('type synth clear', check=False)
-            self.runCmd('type category disable CoreFoundation', check=False)
-            self.runCmd('type category disable CoreGraphics', check=False)
-            self.runCmd('type category disable CoreServices', check=False)
-            self.runCmd('type category disable AppKit', check=False)
 
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
 
-        self.runCmd("type category enable AppKit")
-
         self.expect('frame variable italian', substrs = ['L\'Italia è una Repubblica democratica, fondata sul lavoro. La sovranità appartiene al popolo, che la esercita nelle forme e nei limiti della Costituzione.'])
         self.expect('frame variable french', substrs = ['Que veut cette horde d\'esclaves, De traîtres, de rois conjurés?'])
         self.expect('frame variable german', substrs = ['Über-Ich und aus den Ansprüchen der sozialen Umwelt'])
@@ -165,11 +159,6 @@
             self.runCmd('type format clear', check=False)
             self.runCmd('type summary clear', check=False)
             self.runCmd('type synth clear', check=False)
-            self.runCmd('type category disable CoreFoundation', check=False)
-            self.runCmd('type category disable CoreGraphics', check=False)
-            self.runCmd('type category disable CoreServices', check=False)
-            self.runCmd('type category disable AppKit', check=False)
-
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
@@ -227,16 +216,11 @@
             self.runCmd('type format clear', check=False)
             self.runCmd('type summary clear', check=False)
             self.runCmd('type synth clear', check=False)
-            self.runCmd('type category disable CoreFoundation', check=False)
-            self.runCmd('type category disable CoreGraphics', check=False)
-            self.runCmd('type category disable CoreServices', check=False)
-            self.runCmd('type category disable AppKit', check=False)
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
 
         # Now enable AppKit and check we are displaying Cocoa classes correctly
-        self.runCmd("type category enable AppKit")
         self.expect('frame variable num1 num2 num3 num4 num5 num6 num7 num8_Y num8_N num9',
                     substrs = ['(NSNumber *) num1 = ',' (int)5',
                     '(NSNumber *) num2 = ',' (float)3.1',
@@ -359,8 +343,6 @@
                     '@"Europe/Rome"',
                     '@"Europe/Paris"'])
 
-
-        self.runCmd('type category list')
         self.runCmd('type summary list')
         self.expect('frame variable myclass',
                     substrs = ['(Class) myclass = NSValue'])
@@ -396,17 +378,10 @@
             self.runCmd('type format clear', check=False)
             self.runCmd('type summary clear', check=False)
             self.runCmd('type synth clear', check=False)
-            self.runCmd('type category disable CoreFoundation', check=False)
-            self.runCmd('type category disable CoreGraphics', check=False)
-            self.runCmd('type category disable CoreServices', check=False)
-            self.runCmd('type category disable AppKit', check=False)
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
 
-        # Now enable AppKit
-        self.runCmd("type category enable AppKit")
-
         # check that the formatters are able to deal safely and correctly
         # with ValueObjects that the expression parser returns
         self.expect('expression ((id)@"Hello")', matching=False,
@@ -449,10 +424,6 @@
             self.runCmd('type format clear', check=False)
             self.runCmd('type summary clear', check=False)
             self.runCmd('type synth clear', check=False)
-            self.runCmd('type category disable CoreFoundation', check=False)
-            self.runCmd('type category disable CoreGraphics', check=False)
-            self.runCmd('type category disable CoreServices', check=False)
-            self.runCmd('type category disable AppKit', check=False)
             self.runCmd('log timers disable', check=False)
 
 
@@ -460,10 +431,6 @@
         self.addTearDownHook(cleanup)
 
         # check formatters for common Objective-C types
-        self.runCmd('type category enable CoreFoundation')
-        self.runCmd('type category enable CoreGraphics')
-        self.runCmd('type category enable CoreServices')
-        self.runCmd("type category enable AppKit")
         self.runCmd("log timers enable")
         self.expect("frame variable",
              substrs = ['(CFGregorianUnits) cf_greg_units = 1 years, 3 months, 5 days, 12 hours, 5 minutes 7 seconds',
@@ -514,18 +481,10 @@
             self.runCmd('type format clear', check=False)
             self.runCmd('type summary clear', check=False)
             self.runCmd('type synth clear', check=False)
-            self.runCmd('type category disable CoreFoundation', check=False)
-            self.runCmd('type category disable CoreGraphics', check=False)
-            self.runCmd('type category disable CoreServices', check=False)
-            self.runCmd('type category disable AppKit', check=False)
-
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
 
-        # check formatters for common Objective-C types
-        self.runCmd('type category enable AppKit')
-
         # as long as KVO is implemented by subclassing, this test should succeed
         # we should be able to dynamically figure out that the KVO implementor class
         # is a subclass of Molecule, and use the appropriate summary for it
diff --git a/lldb/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py b/lldb/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py
index f58646f..83080f9 100644
--- a/lldb/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py
+++ b/lldb/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py
@@ -51,13 +51,10 @@
         # clean slate for the next test case.
         def cleanup():
             self.runCmd('type summary clear', check=False)
-            self.runCmd('type category disable VectorTypes', check=False)
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
 
-        self.runCmd('type category enable VectorTypes')
-
         self.expect('frame variable',
             substrs = ['(vFloat) valueFL = (1, 0, 4, 0)',
                        '(int16_t [8]) valueI16 = (1, 0, 4, 0, 0, 1, 0, 4)',
diff --git a/lldb/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py b/lldb/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py
index 7a98802..f1180aa 100644
--- a/lldb/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py
+++ b/lldb/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py
@@ -54,16 +54,11 @@
             self.runCmd('type format clear', check=False)
             self.runCmd('type summary clear', check=False)
             self.runCmd('type synth clear', check=False)
-            self.runCmd('type category disable CoreFoundation', check=False)
-            self.runCmd('type category disable CoreGraphics', check=False)
-            self.runCmd('type category disable CoreServices', check=False)
-            self.runCmd('type category disable AppKit', check=False)
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
 
-        # Now enable AppKit and check we are displaying Cocoa classes correctly
-        self.runCmd("type category enable AppKit")
+        # Now check that we are displaying Cocoa classes correctly
         self.expect('frame variable key',
                     substrs = ['@"1 object"'])
         self.expect('frame variable key', matching=False,
diff --git a/lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py b/lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py
index bb5322d..8b34782 100644
--- a/lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py
+++ b/lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py
@@ -49,10 +49,10 @@
 
         self.runCmd("run", RUN_SUCCEEDED)
         # check that each type is correctly bound to its list of children
-        self.expect("frame variable cf_greg_date", substrs = ['year','month','day','hour','minute','second'])
-        self.expect("frame variable cf_range", substrs = ['location','length'])
+        self.expect("frame variable cf_greg_date --raw", substrs = ['year','month','day','hour','minute','second'])
+        self.expect("frame variable cf_range --raw", substrs = ['location','length'])
         # check that printing both does not somehow confuse LLDB
-        self.expect("frame variable", substrs = ['year','month','day','hour','minute','second','location','length'])
+        self.expect("frame variable  --raw", substrs = ['year','month','day','hour','minute','second','location','length'])
 
 if __name__ == '__main__':
     import atexit