mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Deferred cursor.mangled_name access - on some versions of libclang this causes sigsegv when accessing certain cursor's mangled_name
PiperOrigin-RevId: 334360148 Change-Id: I27ef72b1938052d68b65f99d05d34dcb9f7433f8
This commit is contained in:
parent
376ca05c56
commit
d806e0df3b
|
@ -492,7 +492,6 @@ class Function(object):
|
||||||
self._tu = tu
|
self._tu = tu
|
||||||
self.cursor = cursor # type: cindex.Index
|
self.cursor = cursor # type: cindex.Index
|
||||||
self.name = cursor.spelling # type: Text
|
self.name = cursor.spelling # type: Text
|
||||||
self.mangled_name = cursor.mangled_name # type: Text
|
|
||||||
self.result = ReturnType(self, cursor.result_type)
|
self.result = ReturnType(self, cursor.result_type)
|
||||||
self.original_definition = '{} {}'.format(
|
self.original_definition = '{} {}'.format(
|
||||||
cursor.result_type.spelling, self.cursor.displayname) # type: Text
|
cursor.result_type.spelling, self.cursor.displayname) # type: Text
|
||||||
|
@ -542,7 +541,7 @@ class Function(object):
|
||||||
|
|
||||||
def is_mangled(self):
|
def is_mangled(self):
|
||||||
# type: () -> bool
|
# type: () -> bool
|
||||||
return self.name != self.mangled_name
|
return self.cursor.mangled_name != self.cursor.spelling
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
# type: () -> int
|
# type: () -> int
|
||||||
|
@ -550,7 +549,7 @@ class Function(object):
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
# type: (Function) -> bool
|
# type: (Function) -> bool
|
||||||
return self.mangled_name == other.mangled_name
|
return self.cursor.mangled_name == other.cursor.mangled_name
|
||||||
|
|
||||||
|
|
||||||
class _TranslationUnit(object):
|
class _TranslationUnit(object):
|
||||||
|
|
|
@ -832,7 +832,7 @@ class CodeAnalysisTest(parameterized.TestCase):
|
||||||
functions = tu.get_functions()
|
functions = tu.get_functions()
|
||||||
self.assertLen(functions, 2)
|
self.assertLen(functions, 2)
|
||||||
|
|
||||||
mangled_names = [f.mangled_name for f in functions]
|
mangled_names = [f.cursor.mangled_name for f in functions]
|
||||||
self.assertSameElements(mangled_names, ['sum', '_Z3sumif'])
|
self.assertSameElements(mangled_names, ['sum', '_Z3sumif'])
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user