Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
defb269d
Commit
defb269d
authored
Aug 07, 2016
by
empyrical
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use is_temp and FakeReference for typeid()'s temp variable
parent
b788e10a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
15 deletions
+4
-15
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-13
Cython/Compiler/Symtab.py
Cython/Compiler/Symtab.py
+0
-2
No files found.
Cython/Compiler/ExprNodes.py
View file @
defb269d
...
@@ -10194,7 +10194,6 @@ class TypeidNode(ExprNode):
...
@@ -10194,7 +10194,6 @@ class TypeidNode(ExprNode):
# operand ExprNode
# operand ExprNode
# arg_type ExprNode
# arg_type ExprNode
# is_variable boolean
# is_variable boolean
# mangle_cname string
type
=
PyrexTypes
.
error_type
type
=
PyrexTypes
.
error_type
...
@@ -10202,7 +10201,7 @@ class TypeidNode(ExprNode):
...
@@ -10202,7 +10201,7 @@ class TypeidNode(ExprNode):
arg_type
=
None
arg_type
=
None
is_variable
=
None
is_variable
=
None
mangle_cname
=
None
is_temp
=
1
def
get_type_info_type
(
self
,
env
):
def
get_type_info_type
(
self
,
env
):
if
env
.
is_module_scope
:
if
env
.
is_module_scope
:
...
@@ -10212,7 +10211,7 @@ class TypeidNode(ExprNode):
...
@@ -10212,7 +10211,7 @@ class TypeidNode(ExprNode):
for
module
in
env_module
.
cimported_modules
:
for
module
in
env_module
.
cimported_modules
:
if
module
.
qualified_name
==
'libcpp.typeinfo'
:
if
module
.
qualified_name
==
'libcpp.typeinfo'
:
type_info
=
module
.
lookup
(
'type_info'
)
type_info
=
module
.
lookup
(
'type_info'
)
type_info
=
PyrexTypes
.
c_ref_t
ype
(
PyrexTypes
.
c_const_type
(
type_info
.
type
))
type_info
=
PyrexTypes
.
CFakeReferenceT
ype
(
PyrexTypes
.
c_const_type
(
type_info
.
type
))
return
type_info
return
type_info
return
None
return
None
...
@@ -10238,13 +10237,6 @@ class TypeidNode(ExprNode):
...
@@ -10238,13 +10237,6 @@ class TypeidNode(ExprNode):
elif
not
self
.
arg_type
.
type
.
is_complete
():
elif
not
self
.
arg_type
.
type
.
is_complete
():
self
.
error
(
"Cannot use typeid on incomplete type '%s'"
%
self
.
arg_type
.
type
)
self
.
error
(
"Cannot use typeid on incomplete type '%s'"
%
self
.
arg_type
.
type
)
return
self
return
self
if
env
.
is_module_scope
:
env_module
=
env
else
:
env_module
=
env
.
outer_scope
env_module
.
typeid_variables
+=
1
self
.
mangle_cname
=
"%s_typeid_%s"
%
(
env_module
.
module_cname
,
env_module
.
typeid_variables
)
env
.
use_utility_code
(
UtilityCode
.
load_cached
(
"CppExceptionConversion"
,
"CppSupport.cpp"
))
env
.
use_utility_code
(
UtilityCode
.
load_cached
(
"CppExceptionConversion"
,
"CppSupport.cpp"
))
return
self
return
self
...
@@ -10257,7 +10249,7 @@ class TypeidNode(ExprNode):
...
@@ -10257,7 +10249,7 @@ class TypeidNode(ExprNode):
return
True
return
True
def
calculate_result_code
(
self
):
def
calculate_result_code
(
self
):
return
"(*%s)"
%
self
.
mangle_cnam
e
return
self
.
temp_cod
e
def
generate_result_code
(
self
,
code
):
def
generate_result_code
(
self
,
code
):
if
self
.
is_type
:
if
self
.
is_type
:
...
@@ -10269,9 +10261,8 @@ class TypeidNode(ExprNode):
...
@@ -10269,9 +10261,8 @@ class TypeidNode(ExprNode):
arg_code
=
self
.
arg_type
.
empty_declaration_code
()
arg_code
=
self
.
arg_type
.
empty_declaration_code
()
else
:
else
:
arg_code
=
self
.
arg_type
.
result
()
arg_code
=
self
.
arg_type
.
result
()
code
.
putln
(
"const std::type_info *%s;"
%
self
.
mangle_cname
)
translate_cpp_exception
(
code
,
self
.
pos
,
translate_cpp_exception
(
code
,
self
.
pos
,
"%s =
&typeid(%s);"
%
(
self
.
mangle_cnam
e
,
arg_code
),
"%s =
typeid(%s);"
%
(
self
.
temp_cod
e
,
arg_code
),
None
,
self
.
in_nogil_context
)
None
,
self
.
in_nogil_context
)
class
TypeofNode
(
ExprNode
):
class
TypeofNode
(
ExprNode
):
...
...
Cython/Compiler/Symtab.py
View file @
defb269d
...
@@ -1030,7 +1030,6 @@ class ModuleScope(Scope):
...
@@ -1030,7 +1030,6 @@ class ModuleScope(Scope):
# cpp boolean Compiling a C++ file
# cpp boolean Compiling a C++ file
# is_cython_builtin boolean Is this the Cython builtin scope (or a child scope)
# is_cython_builtin boolean Is this the Cython builtin scope (or a child scope)
# is_package boolean Is this a package module? (__init__)
# is_package boolean Is this a package module? (__init__)
# typeid_variables int Used by the typeid() exception handler
is_module_scope
=
1
is_module_scope
=
1
has_import_star
=
0
has_import_star
=
0
...
@@ -1070,7 +1069,6 @@ class ModuleScope(Scope):
...
@@ -1070,7 +1069,6 @@ class ModuleScope(Scope):
self
.
cached_builtins
=
[]
self
.
cached_builtins
=
[]
self
.
undeclared_cached_builtins
=
[]
self
.
undeclared_cached_builtins
=
[]
self
.
namespace_cname
=
self
.
module_cname
self
.
namespace_cname
=
self
.
module_cname
self
.
typeid_variables
=
0
self
.
_cached_tuple_types
=
{}
self
.
_cached_tuple_types
=
{}
for
var_name
in
[
'__builtins__'
,
'__name__'
,
'__file__'
,
'__doc__'
,
'__path__'
]:
for
var_name
in
[
'__builtins__'
,
'__name__'
,
'__file__'
,
'__doc__'
,
'__path__'
]:
self
.
declare_var
(
EncodedString
(
var_name
),
py_object_type
,
None
)
self
.
declare_var
(
EncodedString
(
var_name
),
py_object_type
,
None
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment