1 /* Definitions for C expressions
3 Copyright (C) 2020 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 #include "objc-lang.h"
26 extern struct value
*eval_op_objc_selector (struct type
*expect_type
,
27 struct expression
*exp
,
33 class c_string_operation
34 : public tuple_holding_operation
<enum c_string_type_values
,
35 std::vector
<std::string
>>
39 using tuple_holding_operation::tuple_holding_operation
;
41 value
*evaluate (struct type
*expect_type
,
42 struct expression
*exp
,
43 enum noside noside
) override
;
45 enum exp_opcode
opcode () const override
49 class objc_nsstring_operation
50 : public tuple_holding_operation
<std::string
>
54 using tuple_holding_operation::tuple_holding_operation
;
56 value
*evaluate (struct type
*expect_type
,
57 struct expression
*exp
,
58 enum noside noside
) override
60 if (noside
== EVAL_SKIP
)
61 return eval_skip_value (exp
);
62 const std::string
&str
= std::get
<0> (m_storage
);
63 return value_nsstring (exp
->gdbarch
, str
.c_str (), str
.size () + 1);
66 enum exp_opcode
opcode () const override
67 { return OP_OBJC_NSSTRING
; }
70 class objc_selector_operation
71 : public tuple_holding_operation
<std::string
>
75 using tuple_holding_operation::tuple_holding_operation
;
77 value
*evaluate (struct type
*expect_type
,
78 struct expression
*exp
,
79 enum noside noside
) override
81 if (noside
== EVAL_SKIP
)
82 return eval_skip_value (exp
);
83 return eval_op_objc_selector (expect_type
, exp
, noside
,
84 std::get
<0> (m_storage
).c_str ());
87 enum exp_opcode
opcode () const override
88 { return OP_OBJC_SELECTOR
; }
This page took 0.031548 seconds and 4 git commands to generate.