File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -402,6 +402,8 @@ std::string clangimport::AstNode::getSpelling() const
402402 return " " ;
403403 if (str.compare (0 ,8 ," <invalid" ) == 0 )
404404 return " " ;
405+ if (nodeType == RecordDecl && str == " struct" )
406+ return " " ;
405407 return str;
406408}
407409
Original file line number Diff line number Diff line change @@ -90,7 +90,8 @@ class TestClangImport : public TestFixture {
9090 TEST_CASE (memberExpr);
9191 TEST_CASE (namespaceDecl1);
9292 TEST_CASE (namespaceDecl2);
93- TEST_CASE (recordDecl);
93+ TEST_CASE (recordDecl1);
94+ TEST_CASE (recordDecl2);
9495 TEST_CASE (switchStmt);
9596 TEST_CASE (typedefDecl1);
9697 TEST_CASE (typedefDecl2);
@@ -881,14 +882,21 @@ class TestClangImport : public TestFixture {
881882 parse (clang));
882883 }
883884
884- void recordDecl () {
885+ void recordDecl1 () {
885886 const char clang[] = " `-RecordDecl 0x354eac8 <1.c:1:1, line:4:1> line:1:8 struct S definition\n "
886887 " |-FieldDecl 0x354eb88 <line:2:3, col:7> col:7 x 'int'\n "
887888 " `-FieldDecl 0x354ebe8 <line:3:3, col:7> col:7 y 'int'" ;
888889 ASSERT_EQUALS (" struct S { int x@1 ; int y@2 ; } ;" ,
889890 parse (clang));
890891 }
891892
893+ void recordDecl2 () {
894+ const char clang[] = " `-RecordDecl 0x3befac8 <2.c:2:1, col:22> col:1 struct definition\n "
895+ " `-FieldDecl 0x3befbf0 <col:10, col:19> col:14 val 'int'" ;
896+ ASSERT_EQUALS (" struct { int val@1 ; } ;" ,
897+ parse (clang));
898+ }
899+
892900 void switchStmt () {
893901 const char clang[] = " `-FunctionDecl 0x2796ba0 <1.c:1:1, col:35> col:6 foo 'void (int)'\n "
894902 " |-ParmVarDecl 0x2796ae0 <col:10, col:14> col:14 used x 'int'\n "
You can’t perform that action at this time.
0 commit comments