[Lldb-commits] [lldb] r172167 - in /lldb/trunk: source/Core/CXXFormatterFunctions.cpp test/lang/cpp/char1632_t/.categories test/lang/cpp/char1632_t/TestChar1632T.py test/lang/cpp/wchar_t/.categories test/lang/cpp/wchar_t/TestCxxWCharT.py

Enrico Granata egranata at apple.com
Thu Jan 10 19:01:25 PST 2013


Author: enrico
Date: Thu Jan 10 21:01:25 2013
New Revision: 172167

URL: http://llvm.org/viewvc/llvm-project?rev=172167&view=rev
Log:
Making the Unicode formatters visually nicer by using the same prefix characters as the compiler expects in C++ code
Also, marking the Unicode data formatters test cases as dataformatter related for the benefit for the --category flag in dotest.py


Added:
    lldb/trunk/test/lang/cpp/char1632_t/.categories
    lldb/trunk/test/lang/cpp/wchar_t/.categories
Modified:
    lldb/trunk/source/Core/CXXFormatterFunctions.cpp
    lldb/trunk/test/lang/cpp/char1632_t/TestChar1632T.py
    lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py

Modified: lldb/trunk/source/Core/CXXFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/CXXFormatterFunctions.cpp?rev=172167&r1=172166&r2=172167&view=diff
==============================================================================
--- lldb/trunk/source/Core/CXXFormatterFunctions.cpp (original)
+++ lldb/trunk/source/Core/CXXFormatterFunctions.cpp Thu Jan 10 21:01:25 2013
@@ -144,7 +144,7 @@
 ReadUTFBufferAndDumpToStream (uint64_t location,
                               const ProcessSP& process_sp,
                               Stream& stream,
-                              bool want_at = true,
+                              char prefix_token = '@',
                               bool want_quotes = true)
 {
     if (location == 0 || location == LLDB_INVALID_ADDRESS)
@@ -175,8 +175,8 @@
     }
     else
     {
-        if (want_at)
-            stream.Printf("@");
+        if (prefix_token != 0)
+            stream.Printf("%c",prefix_token);
         if (want_quotes)
             stream.Printf("\"");
     }
@@ -248,7 +248,7 @@
     if (!ReadUTFBufferAndDumpToStream<UTF16, ConvertUTF16toUTF8>(valobj_addr,
                                                                  process_sp,
                                                                  stream,
-                                                                 false, // no @ sign for C++
+                                                                 'u',
                                                                  true)) // but use quotes
     {
         stream.Printf("Summary Unavailable");
@@ -273,7 +273,7 @@
     if (!ReadUTFBufferAndDumpToStream<UTF32, ConvertUTF32toUTF8>(valobj_addr,
                                                                  process_sp,
                                                                  stream,
-                                                                 false, // no @ sign for C++
+                                                                 'U',
                                                                  true)) // but use quotes
     {
         stream.Printf("Summary Unavailable");
@@ -309,21 +309,21 @@
             return ReadUTFBufferAndDumpToStream<UTF8, nullptr>(valobj_addr,
                                                                process_sp,
                                                                stream,
-                                                               false, // no @ sign for C++
+                                                               'L',
                                                                true); // but use quotes
         case 16:
             // utf 16
             return ReadUTFBufferAndDumpToStream<UTF16, ConvertUTF16toUTF8>(valobj_addr,
                                                                            process_sp,
                                                                            stream,
-                                                                           false, // no @ sign for C++
+                                                                           'L',
                                                                            true); // but use quotes
         case 32:
             // utf 32
             return ReadUTFBufferAndDumpToStream<UTF32, ConvertUTF32toUTF8>(valobj_addr,
                                                                            process_sp,
                                                                            stream,
-                                                                           false, // no @ sign for C++
+                                                                           'L',
                                                                            true); // but use quotes
         default:
             stream.Printf("size for wchar_t is not valid");
@@ -738,7 +738,7 @@
         if (error.Fail())
             return false;
         if (has_explicit_length and is_unicode)
-            return ReadUTFBufferAndDumpToStream<UTF16,ConvertUTF16toUTF8> (location, process_sp, stream);
+            return ReadUTFBufferAndDumpToStream<UTF16,ConvertUTF16toUTF8> (location, process_sp, stream, '@');
         else
         {
             location++;
@@ -781,12 +781,12 @@
             if (error.Fail())
                 return false;
         }
-        return ReadUTFBufferAndDumpToStream<UTF16,ConvertUTF16toUTF8> (location, process_sp, stream);
+        return ReadUTFBufferAndDumpToStream<UTF16,ConvertUTF16toUTF8> (location, process_sp, stream, '@');
     }
     else if (is_special)
     {
         uint64_t location = valobj_addr + (ptr_size == 8 ? 12 : 8);
-        return ReadUTFBufferAndDumpToStream<UTF16,ConvertUTF16toUTF8> (location, process_sp, stream);
+        return ReadUTFBufferAndDumpToStream<UTF16,ConvertUTF16toUTF8> (location, process_sp, stream, '@');
     }
     else if (is_inline)
     {

Added: lldb/trunk/test/lang/cpp/char1632_t/.categories
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/char1632_t/.categories?rev=172167&view=auto
==============================================================================
--- lldb/trunk/test/lang/cpp/char1632_t/.categories (added)
+++ lldb/trunk/test/lang/cpp/char1632_t/.categories Thu Jan 10 21:01:25 2013
@@ -0,0 +1 @@
+dataformatters

Modified: lldb/trunk/test/lang/cpp/char1632_t/TestChar1632T.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/char1632_t/TestChar1632T.py?rev=172167&r1=172166&r2=172167&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/char1632_t/TestChar1632T.py (original)
+++ lldb/trunk/test/lang/cpp/char1632_t/TestChar1632T.py Thu Jan 10 21:01:25 2013
@@ -55,11 +55,11 @@
 
         # Check that we correctly report the const types
         self.expect("frame variable cs16 cs32",
-            substrs = ['(const char16_t *) cs16 = ','(const char32_t *) cs32 = ','"hello world ྒྙྐ"','"hello world ྒྙྐ"'])
+            substrs = ['(const char16_t *) cs16 = ','(const char32_t *) cs32 = ','u"hello world ྒྙྐ"','U"hello world ྒྙྐ"'])
 
         # Check that we correctly report the non-const types
         self.expect("frame variable s16 s32",
-            substrs = ['(char16_t *) s16 = ','(char32_t *) s32 = ','"ﺸﺵۻ"','"ЕЙРГЖО"'])
+            substrs = ['(char16_t *) s16 = ','(char32_t *) s32 = ','u"ﺸﺵۻ"','U"ЕЙРГЖО"'])
 
         self.runCmd("next") # step to after the string is nullified
 
@@ -70,7 +70,7 @@
         self.runCmd("next")
         self.runCmd("next")
 
-        # check that the new strings shows
+        # check that the new strings show
         self.expect("frame variable s16 s32",
             substrs = ['(char16_t *) s16 = 0x','(char32_t *) s32 = ','"色ハ匂ヘト散リヌルヲ"','"෴"'])
 

Added: lldb/trunk/test/lang/cpp/wchar_t/.categories
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/wchar_t/.categories?rev=172167&view=auto
==============================================================================
--- lldb/trunk/test/lang/cpp/wchar_t/.categories (added)
+++ lldb/trunk/test/lang/cpp/wchar_t/.categories Thu Jan 10 21:01:25 2013
@@ -0,0 +1 @@
+dataformatters

Modified: lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py?rev=172167&r1=172166&r2=172167&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py (original)
+++ lldb/trunk/test/lang/cpp/wchar_t/TestCxxWCharT.py Thu Jan 10 21:01:25 2013
@@ -71,7 +71,7 @@
 
         # Mazel Tov if this works!
         self.expect("frame variable mazeltov",
-            substrs = ['(const wchar_t *) mazeltov = ','מזל טוב'])
+            substrs = ['(const wchar_t *) mazeltov = ','L"מזל טוב"'])
 
 
 if __name__ == '__main__':





More information about the lldb-commits mailing list