File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -997,6 +997,16 @@ PyGccNamespaceDecl_declarations(tree t)
997997 return PyGcc_TreeListFromChain (cp_namespace_decls (t ));
998998}
999999
1000+ #if (GCC_VERSION >= 8000 )
1001+
1002+ static int is_namespace (tree decl , void * )
1003+ {
1004+ return (TREE_CODE (decl ) == NAMESPACE_DECL
1005+ && !DECL_NAMESPACE_ALIAS (decl ));
1006+ }
1007+
1008+ #endif /* #if (GCC_VERSION >= 8000) */
1009+
10001010PyObject *
10011011PyGccNamespaceDecl_namespaces (tree t )
10021012{
@@ -1010,7 +1020,15 @@ PyGccNamespaceDecl_namespaces(tree t)
10101020 if (DECL_NAMESPACE_ALIAS (t ))
10111021 return raise_namespace_alias ("gcc.NamespaceDecl.namespaces" );
10121022
1023+ /* GCC 8's r248821 (aka f7564df45462679c3b0b82f2942f5fb50b640113)
1024+ eliminated the "namespaces" field from cp_binding_level. */
1025+
1026+ #if (GCC_VERSION >= 8000 )
1027+ return PyGcc_TreeListFromChainWithFilter (NAMESPACE_LEVEL (t )-> names ,
1028+ is_namespace , NULL );
1029+ #else
10131030 return PyGcc_TreeListFromChain (NAMESPACE_LEVEL (t )-> namespaces );
1031+ #endif
10141032}
10151033
10161034/* Accessing the fields and methods of compound types.
You can’t perform that action at this time.
0 commit comments