Skip to content

Commit 702cd85

Browse files
committed
clang-mirror generated ids integration.
1 parent 44a04ad commit 702cd85

File tree

11 files changed

+67
-74
lines changed

11 files changed

+67
-74
lines changed

CxxTestUtils/inc/GlobalTestUtils.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@ namespace test_utils {
1919
inline constexpr std::string_view STRB = "cxxReflection";
2020
inline constexpr std::string_view STRB_REVERSE = "noitcelfeRxxc";
2121

22-
inline constexpr std::string_view str_reverseString = "reverseString";
23-
inline constexpr std::string_view str_revStrConstRefArg = "revStrConstRefArg";
24-
inline constexpr std::string_view str_revStrRValueRefArg = "revStrRValueRefArg";
25-
inline constexpr std::string_view str_revStrNonConstRefArg = "revStrNonConstRefArg";
26-
inline constexpr std::string_view str_revStrOverloadValRef = "revStrOverloadValRef";
27-
inline constexpr std::string_view str_revStrOverloadValCRef = "revStrOverloadValCRef";
28-
2922
inline constexpr std::string_view SUFFIX_void = "_void";
3023
inline constexpr std::string_view SUFFIX_ctor = "_ctor";
3124
inline constexpr std::string_view SUFFIX_const = "_const";

RTLTestRunApp/src/CxxMirrorTests/CxxMirrorThreadingTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ namespace rtl_tests
127127
{
128128
auto _ = rtl::CxxMirror({
129129

130-
rtl::type().function<void>(str_reverseString).build(reverseString),
130+
rtl::type().function<void>(cxx::fn::reverseString::id).build(reverseString),
131131

132-
rtl::type().function<std::string>(str_reverseString).build(reverseString),
132+
rtl::type().function<std::string>(cxx::fn::reverseString::id).build(reverseString),
133133

134-
rtl::type().function<const char*>(str_reverseString).build(reverseString),
134+
rtl::type().function<const char*>(cxx::fn::reverseString::id).build(reverseString),
135135

136136
rtl::type().function(cxx::fn::getComplexNumAsString::id).build(getComplexNumAsString),
137137

RTLTestRunApp/src/FunctionalityTests/NameSpaceGlobalsTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ namespace rtl_tests
204204

205205
TEST(GlobalFunction, overloaded_function_execute_return)
206206
{
207-
optional<Function> fnReverseString = cxx::mirror().getFunction(str_reverseString);
207+
optional<Function> fnReverseString = cxx::mirror().getFunction(cxx::fn::reverseString::id);
208208
ASSERT_TRUE(fnReverseString);
209209

210210
rtl::function<rtl::Return(std::string)> reverseString = fnReverseString->argsT<std::string>().returnT<>();

RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_ConstMethod.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace rtl_tests
5353
std::optional<rtl::Record> optStringUtil = cxx::mirror().getRecord(StrConst::struct_);
5454
ASSERT_TRUE(optStringUtil);
5555

56-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_reverseString);
56+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id);
5757
ASSERT_TRUE(reverseString);
5858
{
5959
rtl::const_method<StrConst, std::string(char*)> reverse_string = reverseString->targetT<const StrConst>()
@@ -82,7 +82,7 @@ namespace rtl_tests
8282
std::optional<rtl::Record> optStringUtil = cxx::mirror().getRecord(StrConst::struct_);
8383
ASSERT_TRUE(optStringUtil);
8484

85-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_reverseString);
85+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id);
8686
ASSERT_TRUE(reverseString);
8787
{
8888
rtl::const_method<StrConst, std::string(const char)> reverse_string = reverseString->targetT<const StrConst>()
@@ -140,7 +140,7 @@ namespace rtl_tests
140140
std::optional<rtl::Record> optStringUtil = cxx::mirror().getRecord(StrConst::struct_);
141141
ASSERT_TRUE(optStringUtil);
142142

143-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_reverseString);
143+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id);
144144
ASSERT_TRUE(reverseString);
145145
{
146146
//argument lvalue-ref.
@@ -204,7 +204,7 @@ namespace rtl_tests
204204
ASSERT_TRUE(optStringUtil);
205205

206206

207-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_reverseString);
207+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id);
208208
ASSERT_TRUE(reverseString);
209209
{
210210
rtl::const_method<StrConst, std::string(std::string&&)> reverse_string = reverseString->targetT<const StrConst>()
@@ -242,7 +242,7 @@ namespace rtl_tests
242242

243243
StrConst target;
244244
std::string str(STRA);
245-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_reverseString);
245+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id);
246246
ASSERT_TRUE(reverseString);
247247
{
248248
rtl::const_method<StrConst, std::string(std::string*)> reverse_string = reverseString->targetT<const StrConst>()
@@ -303,7 +303,7 @@ namespace rtl_tests
303303
StrConst target;
304304
std::string str(STRA);
305305
{
306-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_revStrConstRefArg);
306+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::revStrConstRefArg::id);
307307
ASSERT_TRUE(reverseString);
308308

309309
rtl::const_method<StrConst, std::string(const std::string_view&)> reverse_string = reverseString->targetT<const StrConst>()
@@ -317,7 +317,7 @@ namespace rtl_tests
317317
auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref).append(SUFFIX_const);
318318
EXPECT_EQ(ret_str, exp_str);
319319
} {
320-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_revStrNonConstRefArg);
320+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::revStrNonConstRefArg::id);
321321
ASSERT_TRUE(reverseString);
322322

323323
rtl::const_method<StrConst, std::string(std::string_view&)> reverse_string = reverseString->targetT<const StrConst>()
@@ -331,7 +331,7 @@ namespace rtl_tests
331331
auto exp_str = std::string(StrConst::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref).append(SUFFIX_const);
332332
EXPECT_EQ(ret_str, exp_str);
333333
} {
334-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_revStrRValueRefArg);
334+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::revStrRValueRefArg::id);
335335
ASSERT_TRUE(reverseString);
336336

337337
rtl::const_method<StrConst, std::string(std::string_view&&)> reverse_string = reverseString->targetT<const StrConst>()
@@ -353,7 +353,7 @@ namespace rtl_tests
353353
ASSERT_TRUE(optStringUtil);
354354

355355
StrConst target;
356-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_revStrOverloadValRef);
356+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::revStrOverloadValRef::id);
357357
ASSERT_TRUE(reverseString);
358358
{
359359
rtl::const_method<StrConst, std::string(std::string_view)> reverse_string = reverseString->targetT<const StrConst>()
@@ -385,7 +385,7 @@ namespace rtl_tests
385385
ASSERT_TRUE(optStringUtil);
386386

387387
StrConst target;
388-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_revStrOverloadValCRef);
388+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::revStrOverloadValCRef::id);
389389
ASSERT_TRUE(reverseString);
390390
{
391391
rtl::const_method<StrConst, std::string(std::string_view)> reverse_string = reverseString->targetT<const StrConst>()

RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Function.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ namespace rtl_tests
102102

103103
TEST(TypeAware_Function, overload_resolution_with_known_signatures)
104104
{
105-
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(str_reverseString);
105+
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(cxx::fn::reverseString::id);
106106
ASSERT_TRUE(reverseString);
107107
{
108108
rtl::function<std::string(const char)> reverse_string = reverseString->argsT<const char>().returnT<std::string>();
@@ -137,7 +137,7 @@ namespace rtl_tests
137137

138138
TEST(TypeAware_Function, lvalue_ref_overload_resolution_with_known_signatures)
139139
{
140-
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(str_reverseString);
140+
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(cxx::fn::reverseString::id);
141141
ASSERT_TRUE(reverseString);
142142
{
143143
rtl::function<std::string(std::string&)> reverse_string = reverseString->argsT<std::string&>().returnT<std::string>();
@@ -161,7 +161,7 @@ namespace rtl_tests
161161

162162
TEST(TypeAware_Function, rvalue_ref_overload_resolution_with_known_signatures)
163163
{
164-
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(str_reverseString);
164+
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(cxx::fn::reverseString::id);
165165
ASSERT_TRUE(reverseString);
166166
{
167167
rtl::function<std::string(std::string&&)> reverse_string = reverseString->argsT<std::string&&>().returnT<std::string>();
@@ -180,7 +180,7 @@ namespace rtl_tests
180180
TEST(TypeAware_Function, ptr_and_const_ptr_overload_resolution_with_known_signatures)
181181
{
182182
std::string str(STRA);
183-
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(str_reverseString);
183+
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(cxx::fn::reverseString::id);
184184
ASSERT_TRUE(reverseString);
185185
{
186186
rtl::function<std::string(std::string*)> reverse_string = reverseString->argsT<std::string*>().returnT<std::string>();
@@ -204,7 +204,7 @@ namespace rtl_tests
204204
{
205205
std::string str(STRA);
206206
{
207-
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(str_revStrConstRefArg);
207+
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(cxx::fn::revStrConstRefArg::id);
208208
ASSERT_TRUE(reverseString);
209209

210210
rtl::function<std::string(const std::string_view&)> reverse_string = reverseString->argsT<const std::string_view&>().returnT<std::string>();
@@ -214,7 +214,7 @@ namespace rtl_tests
214214
auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_clvref);
215215
EXPECT_EQ(ret_str, exp_str);
216216
} {
217-
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(str_revStrNonConstRefArg);
217+
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(cxx::fn::revStrNonConstRefArg::id);
218218
ASSERT_TRUE(reverseString);
219219

220220
rtl::function<std::string(std::string_view&)> reverse_string = reverseString->argsT<std::string_view&>().returnT<std::string>();
@@ -225,7 +225,7 @@ namespace rtl_tests
225225
auto exp_str = std::string(STRA_REVERSE).append(SUFFIX_std_string_view_lvref);
226226
EXPECT_EQ(ret_str, exp_str);
227227
} {
228-
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(str_revStrRValueRefArg);
228+
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(cxx::fn::revStrRValueRefArg::id);
229229
ASSERT_TRUE(reverseString);
230230

231231
rtl::function<std::string(std::string_view&&)> reverse_string = reverseString->argsT<std::string_view&&>().returnT<std::string>();
@@ -240,7 +240,7 @@ namespace rtl_tests
240240

241241
TEST(TypeAware_Function, overloads_with_ref_and_value_args_call_with_known_signature)
242242
{
243-
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(str_revStrOverloadValRef);
243+
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(cxx::fn::revStrOverloadValRef::id);
244244
ASSERT_TRUE(reverseString);
245245
{
246246
rtl::function<std::string(std::string_view)> reverse_string = reverseString->argsT<std::string_view>().returnT<std::string>();
@@ -263,7 +263,7 @@ namespace rtl_tests
263263

264264
TEST(TypeAware_Function, overloads_with_const_ref_and_value_args_call_with_known_signature)
265265
{
266-
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(str_revStrOverloadValCRef);
266+
std::optional<rtl::Function> reverseString = cxx::mirror().getFunction(cxx::fn::revStrOverloadValCRef::id);
267267
ASSERT_TRUE(reverseString);
268268
{
269269
rtl::function<std::string(std::string_view)> reverse_string = reverseString->argsT<std::string_view>().returnT<std::string>();

RTLTestRunApp/src/FunctionalityTests/TypeAwareInvocationTests/TypeAware_Method.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace rtl_tests
1818
std::optional<rtl::Record> optStringUtil = cxx::mirror().getRecord(StrMute::struct_);
1919
ASSERT_TRUE(optStringUtil);
2020

21-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_reverseString);
21+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id);
2222
ASSERT_TRUE(reverseString);
2323
{
2424
rtl::method<StrMute, std::string(char*)> reverse_string = reverseString->targetT<StrMute>()
@@ -47,7 +47,7 @@ namespace rtl_tests
4747
std::optional<rtl::Record> optStringUtil = cxx::mirror().getRecord(StrMute::struct_);
4848
ASSERT_TRUE(optStringUtil);
4949

50-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_reverseString);
50+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id);
5151
ASSERT_TRUE(reverseString);
5252
{
5353
rtl::method<StrMute, std::string(const char)> reverse_string = reverseString->targetT<StrMute>()
@@ -107,7 +107,7 @@ namespace rtl_tests
107107

108108
//non-const target.
109109
StrMute target;
110-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_reverseString);
110+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id);
111111
ASSERT_TRUE(reverseString);
112112
{
113113
//argument lvalue-ref
@@ -173,7 +173,7 @@ namespace rtl_tests
173173
ASSERT_TRUE(optStringUtil);
174174

175175
StrMute target;
176-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_reverseString);
176+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id);
177177
ASSERT_TRUE(reverseString);
178178
{
179179
rtl::method<StrMute, std::string(std::string&&)> reverse_string = reverseString->targetT<StrMute>()
@@ -200,7 +200,7 @@ namespace rtl_tests
200200

201201
StrMute target;
202202
std::string str(STRA);
203-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_reverseString);
203+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::reverseString::id);
204204
ASSERT_TRUE(reverseString);
205205
{
206206
rtl::method<StrMute, std::string(std::string*)> reverse_string = reverseString->targetT<StrMute>()
@@ -232,7 +232,7 @@ namespace rtl_tests
232232
StrMute target;
233233
std::string str(STRA);
234234
{
235-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_revStrConstRefArg);
235+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::revStrConstRefArg::id);
236236
ASSERT_TRUE(reverseString);
237237

238238
rtl::method<StrMute, std::string(const std::string_view&)> reverse_string = reverseString->targetT<StrMute>()
@@ -244,7 +244,7 @@ namespace rtl_tests
244244
auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_clvref);
245245
EXPECT_EQ(ret_str, exp_str);
246246
} {
247-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_revStrNonConstRefArg);
247+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::revStrNonConstRefArg::id);
248248
ASSERT_TRUE(reverseString);
249249

250250
rtl::method<StrMute, std::string(std::string_view&)> reverse_string = reverseString->targetT<StrMute>()
@@ -257,7 +257,7 @@ namespace rtl_tests
257257
auto exp_str = std::string(StrMute::struct_).append(STRA_REVERSE).append(SUFFIX_std_string_view_lvref);
258258
EXPECT_EQ(ret_str, exp_str);
259259
} {
260-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_revStrRValueRefArg);
260+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::revStrRValueRefArg::id);
261261
ASSERT_TRUE(reverseString);
262262

263263
rtl::method<StrMute, std::string(std::string_view&&)> reverse_string = reverseString->targetT<StrMute>()
@@ -278,7 +278,7 @@ namespace rtl_tests
278278
ASSERT_TRUE(optStringUtil);
279279

280280
StrMute target;
281-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_revStrOverloadValRef);
281+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::revStrOverloadValRef::id);
282282
ASSERT_TRUE(reverseString);
283283
{
284284
rtl::method<StrMute, std::string(std::string_view)> reverse_string = reverseString->targetT<StrMute>()
@@ -309,7 +309,7 @@ namespace rtl_tests
309309
ASSERT_TRUE(optStringUtil);
310310

311311
StrMute target;
312-
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(str_revStrOverloadValCRef);
312+
std::optional<rtl::Method> reverseString = optStringUtil->getMethod(cxx::fn::revStrOverloadValCRef::id);
313313
ASSERT_TRUE(reverseString);
314314
{
315315
rtl::method<StrMute, std::string(std::string_view)> reverse_string = reverseString->targetT<StrMute>()

0 commit comments

Comments
 (0)