diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -5277,7 +5277,7 @@ case clang::Type::RValueReference: return lldb::eFormatHex; case clang::Type::MemberPointer: - break; + return lldb::eFormatHex; case clang::Type::Complex: { if (qual_type->isComplexType()) return lldb::eFormatComplex; diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py b/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py --- a/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py @@ -285,3 +285,14 @@ matching=False, substrs=['(int) iAmInt = 0x00000001']) self.expect("frame variable iAmInt", substrs=['(int) iAmInt = 1']) + + # Check that pointer to members are correctly formatted + self.expect( + "frame variable member_ptr", + substrs=['member_ptr = 0x']) + self.expect( + "frame variable member_func_ptr", + substrs=['member_func_ptr = 0x']) + self.expect( + "frame variable ref_to_member_func_ptr", + substrs=['ref_to_member_func_ptr = 0x']) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp --- a/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp @@ -57,6 +57,8 @@ { const char* pointer; IUseCharStar() : pointer("Hello world") {} + + char const *member_func(int) { return ""; } }; int main (int argc, const char * argv[]) @@ -106,7 +108,12 @@ char* strptr = "Hello world!"; i_am_cooler the_coolest_guy(1,2,3.14,6.28,'E','G'); - + + const char *IUseCharStar::*member_ptr = &IUseCharStar::pointer; + const char *(IUseCharStar::*member_func_ptr)(int) = + &IUseCharStar::member_func; + auto &ref_to_member_func_ptr = member_func_ptr; + return 0; // Set break point at this line. }