diff options
author | shafik <syaghmour@apple.com> | 2019-10-28 14:26:54 -0700 |
---|---|---|
committer | shafik <syaghmour@apple.com> | 2019-10-28 14:26:54 -0700 |
commit | de2c7cab715e195c9d559d317beb760cf0b95262 (patch) | |
tree | de47d5d14cd124b309b175df5f44bbbcf2e1ce0c /lldb/packages/Python/lldbsuite/test | |
parent | 85b718f53a3575bca2f1b7fdb1b3aaa6df7c10e3 (diff) | |
download | bcm5719-llvm-de2c7cab715e195c9d559d317beb760cf0b95262.tar.gz bcm5719-llvm-de2c7cab715e195c9d559d317beb760cf0b95262.zip |
Add support for DW_AT_export_symbols for anonymous structs
Summary:
We add support for DW_AT_export_symbols to detect anonymous struct on top of the heuristics implemented in D66175
This should allow us to differentiate anonymous structs and unnamed structs.
We also fix TestTypeList.py which was incorrectly detecting an unnamed struct as an anonymous struct.
Differential Revision: https://reviews.llvm.org/D68961
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py | 8 | ||||
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/python_api/type/main.cpp | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py b/lldb/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py index b3b321c6ca8..75a793a95b2 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py @@ -73,13 +73,17 @@ class TypeAndTypeListTestCase(TestBase): self.assertTrue(enum_member) self.DebugSBType(enum_member.type) elif field.name == "my_type_is_nameless": - self.assertTrue( + self.assertFalse( field.type.IsAnonymousType(), - "my_type_is_nameless has an anonymous type") + "my_type_is_nameless is not an anonymous type") elif field.name == "my_type_is_named": self.assertFalse( field.type.IsAnonymousType(), "my_type_is_named has a named type") + elif field.name == None: + self.assertTrue( + field.type.IsAnonymousType(), + "Nameless type is not anonymous") # Pass an empty string. LLDB should not crash. :-) fuzz_types = target.FindTypes(None) diff --git a/lldb/packages/Python/lldbsuite/test/python_api/type/main.cpp b/lldb/packages/Python/lldbsuite/test/python_api/type/main.cpp index 8f5b93927c7..b43b617b0f9 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/type/main.cpp +++ b/lldb/packages/Python/lldbsuite/test/python_api/type/main.cpp @@ -15,6 +15,14 @@ public: TASK_TYPE_1, TASK_TYPE_2 } type; + // This struct is anonymous b/c it does not have a name + // and it is not unnamed class. + // Anonymous classes are a GNU extension. + struct { + int y; + }; + // This struct is an unnamed class see [class.pre]p1 + // http://eel.is/c++draft/class#pre-1.sentence-6 struct { int x; } my_type_is_nameless; |