clang import: fixed problem with nameless struct
This commit is contained in:
parent
57f5b19b34
commit
c26e205e29
|
@ -402,6 +402,8 @@ std::string clangimport::AstNode::getSpelling() const
|
|||
return "";
|
||||
if (str.compare(0,8,"<invalid") == 0)
|
||||
return "";
|
||||
if (nodeType == RecordDecl && str == "struct")
|
||||
return "";
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,8 @@ private:
|
|||
TEST_CASE(memberExpr);
|
||||
TEST_CASE(namespaceDecl1);
|
||||
TEST_CASE(namespaceDecl2);
|
||||
TEST_CASE(recordDecl);
|
||||
TEST_CASE(recordDecl1);
|
||||
TEST_CASE(recordDecl2);
|
||||
TEST_CASE(switchStmt);
|
||||
TEST_CASE(typedefDecl1);
|
||||
TEST_CASE(typedefDecl2);
|
||||
|
@ -881,7 +882,7 @@ private:
|
|||
parse(clang));
|
||||
}
|
||||
|
||||
void recordDecl() {
|
||||
void recordDecl1() {
|
||||
const char clang[] = "`-RecordDecl 0x354eac8 <1.c:1:1, line:4:1> line:1:8 struct S definition\n"
|
||||
" |-FieldDecl 0x354eb88 <line:2:3, col:7> col:7 x 'int'\n"
|
||||
" `-FieldDecl 0x354ebe8 <line:3:3, col:7> col:7 y 'int'";
|
||||
|
@ -889,6 +890,13 @@ private:
|
|||
parse(clang));
|
||||
}
|
||||
|
||||
void recordDecl2() {
|
||||
const char clang[] = "`-RecordDecl 0x3befac8 <2.c:2:1, col:22> col:1 struct definition\n"
|
||||
" `-FieldDecl 0x3befbf0 <col:10, col:19> col:14 val 'int'";
|
||||
ASSERT_EQUALS("struct { int val@1 ; } ;",
|
||||
parse(clang));
|
||||
}
|
||||
|
||||
void switchStmt() {
|
||||
const char clang[] = "`-FunctionDecl 0x2796ba0 <1.c:1:1, col:35> col:6 foo 'void (int)'\n"
|
||||
" |-ParmVarDecl 0x2796ae0 <col:10, col:14> col:14 used x 'int'\n"
|
||||
|
|
Loading…
Reference in New Issue