This revision was automatically updated to reflect the committed changes. Closed by commit rGb642fd5ee250: [lldb][TypeSystemClang] Format pointers to member functions as eFormatHex (authored by Michael137).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145241/new/ https://reviews.llvm.org/D145241 Files: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp Index: lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp =================================================================== --- lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp +++ 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. } Index: lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py =================================================================== --- lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py +++ 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']) Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp =================================================================== --- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ 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;
Index: lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp =================================================================== --- lldb/test/API/functionalities/data-formatter/data-formatter-cpp/main.cpp +++ 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. } Index: lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py =================================================================== --- lldb/test/API/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py +++ 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']) Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp =================================================================== --- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ 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;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits