Skip to content

Commit

Permalink
Add typedef
Browse files Browse the repository at this point in the history
  • Loading branch information
pfernique committed Jan 28, 2017
1 parent e3fc272 commit 8057752
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion AutoWIG.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def bootstrap_controller(asg):
autowig.controller.plugin = 'bootstrap'
autowig.controller(asg)

def bootstrap_generator(asg)
def bootstrap_generator(asg):
subset = asg.nodes('::clang::tooling::buildASTFromCodeWithArgs')
classes = [asg['class ::clang::PCHContainerOperations'], asg['class ::clang::Type'], asg['class ::clang::Decl']]
subset += classes
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ namespace clanglite
}

clang::TypedefNameDecl * get_as_typedef_name_decl(clang::Type& type)
{ return type.getAs< clang::TypedefType >()->getDecl(); }

{ return type.getAs< clang::TypedefType >()->getDecl(); }
clang::TranslationUnitDecl * as_translation_unit(clang::DeclContext * decl)
{ return static_cast< clang::TranslationUnitDecl * >(decl); }

Expand Down
10 changes: 9 additions & 1 deletion src/py/clanglite/autowig_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@ def read_qualified_type(asg, qtype, inline):
while True:
if ttype is None:
raise NotImplementedError('none type')
elif ttype.get_type_class() in [clang.Type.type_class.TYPEDEF, clang.Type.type_class.SUBST_TEMPLATE_TYPE_PARM, clang.Type.type_class.ELABORATED]:
elif ttype.get_type_class() in [clang.Type.type_class.TYPEDEF]:
if qtype.is_local_const_qualified() and not qualifiers.startswith(' const'):
qualifiers = ' const' + qualifiers
if qtype.is_local_volatile_qualified() and not qualifiers.startswith(' volatile'):
qualifiers = ' volatile' + qualifiers
typedef = qtype.get_as_typedef_name_decl()
typedef = read_typedef(asg, typedef, out=False, inline=inline, permissive=False)
return typedef[0], qualifiers
elif ttype.get_type_class() in [clang.Type.type_class.SUBST_TEMPLATE_TYPE_PARM, clang.Type.type_class.ELABORATED]:
qtype = ttype.get_canonical_type_internal()
if qtype.is_local_const_qualified() and not qualifiers.startswith(' const'):
qualifiers = ' const' + qualifiers
Expand Down
1 change: 1 addition & 0 deletions src/py/wrapper_fa70cbf14eb958718b2fd94051e17863.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ void wrapper_fa70cbf14eb958718b2fd94051e17863()
class_fa70cbf14eb958718b2fd94051e17863.def("cast_as_array_type_unsafe", method_pointer_5777011164fb5f3d97a440042eba7a66, boost::python::return_value_policy< boost::python::reference_existing_object >(), "");
class_fa70cbf14eb958718b2fd94051e17863.def("contains_unexpanded_parameter_pack", method_pointer_bfedba3fd45854d1af5b3c1c528605b7, "");
class_fa70cbf14eb958718b2fd94051e17863.def("dump", method_pointer_4a8f82f467b45c7a8237200063b9a86a, "");
class_fa70cbf14eb958718b2fd94051e17863.def("get_as_typedef_name_decl", clanglite::get_as_typedef_name_decl, boost::python::return_value_policy< boost::python::reference_existing_object >(), "");
class_fa70cbf14eb958718b2fd94051e17863.def("get_array_element_type_no_type_qual", method_pointer_1de0cc73c8395b55b171cfd12a6f6318, boost::python::return_value_policy< boost::python::reference_existing_object >(), "");
class_fa70cbf14eb958718b2fd94051e17863.def("get_as_array_type_unsafe", method_pointer_454b694c94f35490882103f1a190256a, boost::python::return_value_policy< boost::python::reference_existing_object >(), "");
class_fa70cbf14eb958718b2fd94051e17863.def("get_as_cxx_record_decl", method_pointer_b4068e3fd2715d66a530f60d3ee21275, boost::python::return_value_policy< boost::python::reference_existing_object >(), "");
Expand Down

0 comments on commit 8057752

Please sign in to comment.