gdb/testsuite: enable running gdb.cp/classes.exp with clang
When attempting to run the gdb.cp/classes.exp test using Clang++, the
test fails to prepare with -Wnon-c-typedef-for-linkage like the
previously fixed gdb.cp/class2.exp. Upon fixing this, the test shows 5
unexpected failures. One such failures is:
ptype/r class class_with_public_typedef
type = class class_with_public_typedef {
private:
int a;
public:
class_with_public_typedef::INT b;
private:
typedef int INT;
}
(gdb) FAIL: gdb.cp/classes.exp: ptype class class_with_public_typedef // wrong access specifier for typedef: private
While g++ provided the following output:
ptype/r class class_with_public_typedef
type = class class_with_public_typedef {
private:
int a;
public:
class_with_public_typedef::INT b;
typedef int INT;
}
(gdb) PASS: gdb.cp/classes.exp: ptype class class_with_public_typedef
This error happens because Clang does not add DW_AT_accessibility to
typedefs inside classes, and without this information GDB defaults to
assuming the typedef is private. Since there is nothing that GDB can do
about this, these tests have been set as xfails, and Clang bug 57608 has
been filed.
Bug: https://github.com/llvm/llvm-project/issues/57608
Approved-by: Tom Tromey <tom@tromey.com>