Debian Codegraph @

cross-project-tests/debuginfo-tests/dexter/dex/dextIR/ValueIR.py

raw
1 # DExTer : Debugging Experience Tester
2 # ~~~~~~ ~ ~~ ~ ~~
3 #
4 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 # See https://llvm.org/LICENSE.txt for license information.
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
8
9 class ValueIR:
10 """Data class to store the result of an expression evaluation."""
11
12 def __init__(
13 self,
14 expression: str,
15 value: str,
16 type_name: str,
17 could_evaluate: bool,
18 error_string: str = None,
19 is_optimized_away: bool = False,
20 is_irretrievable: bool = False,
21 ):
22 self.expression = expression
23 self.value = value
24 self.type_name = type_name
25 self.could_evaluate = could_evaluate
26 self.error_string = error_string
27 self.is_optimized_away = is_optimized_away
28 self.is_irretrievable = is_irretrievable
29
30 def __str__(self):
31 prefix = '"{}": '.format(self.expression)
32 if self.error_string is not None:
33 return prefix + self.error_string
34 if self.value is not None:
35 return prefix + "({}) {}".format(self.type_name, self.value)
36 return (
37 prefix
38 + "could_evaluate: {}; irretrievable: {}; optimized_away: {};".format(
39 self.could_evaluate, self.is_irretrievable, self.is_optimized_away
40 )
41 )