| ... | ... | @@ -49,7 +49,7 @@ static AstNode *pointer_to_type(Context *c, AstNode *type_node, bool is_const) { |
| 49 | 49 | return node; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | | static AstNode *type_node(Context *c, const Type *ty, bool is_const) { |
| 52 | static AstNode *type_node(Context *c, const Type *ty) { |
| 53 | 53 | switch (ty->getTypeClass()) { |
| 54 | 54 | case Type::Builtin: |
| 55 | 55 | { |
| ... | ... | @@ -120,10 +120,17 @@ static AstNode *type_node(Context *c, const Type *ty, bool is_const) { |
| 120 | 120 | case Type::Pointer: |
| 121 | 121 | { |
| 122 | 122 | const PointerType *pointer_ty = static_cast<const PointerType*>(ty); |
| 123 | | AstNode *type_node = type_node_from_qual_type(c, pointer_ty->getPointeeType()); |
| 124 | | return pointer_to_type(c, type_node, is_const); |
| 123 | QualType child_qt = pointer_ty->getPointeeType(); |
| 124 | AstNode *type_node = type_node_from_qual_type(c, child_qt); |
| 125 | return pointer_to_type(c, type_node, child_qt.isConstQualified()); |
| 125 | 126 | } |
| 126 | 127 | case Type::Typedef: |
| 128 | { |
| 129 | const TypedefType *typedef_ty = static_cast<const TypedefType*>(ty); |
| 130 | const TypedefNameDecl *typedef_decl = typedef_ty->getDecl(); |
| 131 | const char *type_name = buf_ptr(buf_create_from_str(decl_name(typedef_decl))); |
| 132 | return simple_type_node(c, type_name); |
| 133 | } |
| 127 | 134 | case Type::FunctionProto: |
| 128 | 135 | case Type::Record: |
| 129 | 136 | case Type::Enum: |
| ... | ... | @@ -168,8 +175,7 @@ static AstNode *type_node(Context *c, const Type *ty, bool is_const) { |
| 168 | 175 | } |
| 169 | 176 | |
| 170 | 177 | static AstNode *type_node_from_qual_type(Context *c, QualType qt) { |
| 171 | | bool is_const = qt.isConstQualified(); |
| 172 | | return type_node(c, qt.getTypePtr(), is_const); |
| 178 | return type_node(c, qt.getTypePtr()); |
| 173 | 179 | } |
| 174 | 180 | |
| 175 | 181 | static bool decl_visitor(void *context, const Decl *decl) { |
| ... | ... | @@ -210,6 +216,16 @@ static bool decl_visitor(void *context, const Decl *decl) { |
| 210 | 216 | |
| 211 | 217 | break; |
| 212 | 218 | } |
| 219 | /* |
| 220 | case Decl::Typedef: |
| 221 | { |
| 222 | AstNode *node = create_node(c, NodeTypeVariableDeclaration); |
| 223 | node->data.variable_declaration.is_const = true; |
| 224 | buf_init_from_str(&node->data.variable_declaration.symbol, decl_name(decl)); |
| 225 | |
| 226 | break; |
| 227 | } |
| 228 | */ |
| 213 | 229 | default: |
| 214 | 230 | if (c->warnings_on) { |
| 215 | 231 | fprintf(stderr, "ignoring %s\n", decl->getDeclKindName()); |