File tree Expand file tree Collapse file tree 4 files changed +771
-449
lines changed Expand file tree Collapse file tree 4 files changed +771
-449
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,9 @@ macro(add_libclc_builtin_set arch_suffix)
108
108
109
109
# Generate remangled variants if requested
110
110
if ( LIBCLC_GENERATE_REMANGLED_VARIANTS )
111
+ set (dummy_in "${CMAKE_BINARY_DIR} /lib/clc/libclc_dummy_in.cc" )
112
+ add_custom_command ( OUTPUT ${dummy_in}
113
+ COMMAND ${CMAKE_COMMAND} -E touch ${dummy_in} )
111
114
set (long_widths l32 l64 )
112
115
set (char_signedness signed unsigned )
113
116
# All permutations of [l32, l64] and [signed, unsigned]
@@ -121,10 +124,11 @@ macro(add_libclc_builtin_set arch_suffix)
121
124
-o "${builtins_remangle_path} "
122
125
--long-width=${long_width}
123
126
--char-signedness=${signedness}
124
- "$<TARGET_PROPERTY:prepare-${obj_suffix} ,TARGET_FILE>"
127
+ --input-ir= "$<TARGET_PROPERTY:prepare-${obj_suffix} ,TARGET_FILE>"
128
+ ${dummy_in}
125
129
DEPENDS "${builtins_obj_path} " "prepare-${obj_suffix} " libclc-remangler )
126
130
add_custom_target ( "remangled-${long_width} -${signedness} _char.${obj_suffix} " ALL
127
- DEPENDS "${builtins_remangle_path} " )
131
+ DEPENDS "${builtins_remangle_path} " " ${dummy_in} " )
128
132
set_target_properties ("remangled-${long_width} -${signedness} _char.${obj_suffix} "
129
133
PROPERTIES TARGET_FILE "${builtins_remangle_path} " )
130
134
Original file line number Diff line number Diff line change @@ -43,3 +43,27 @@ foreach( t ${LIBCLC_TARGET_TO_TEST} )
43
43
44
44
endforeach ( d )
45
45
endforeach ( t )
46
+
47
+ if (LIBCLC_GENERATE_REMANGLED_VARIANTS )
48
+ # Run remangler in test mode if generating remangled variants and make sure
49
+ # it depends on check-libclc target.
50
+ # Both `long_widths` and `char_signedness` are set in AddLibclc.cmake and can
51
+ # be used here.
52
+ foreach (long_width ${long_widths} )
53
+ foreach (signedness ${char_signedness} )
54
+ # In `-t` (TestRun) the remangler does not perform any substitutions, it
55
+ # needs to make sure that the remangled name matches the original mangled
56
+ # one.
57
+ set (test_target_name "test-remangled-${long_width} -${signedness} _char" )
58
+ add_custom_target (${test_target_name}
59
+ COMMAND libclc-remangler
60
+ --long-width=${long_width}
61
+ --char-signedness=${signedness}
62
+ --input-ir= "$<TARGET_PROPERTY:prepare-${obj_suffix} ,TARGET_FILE>"
63
+ ${dummy_in} -t -o -
64
+ DEPENDS "${builtins_obj_path} " "prepare-${obj_suffix} " "${dummy_in} " libclc-remangler )
65
+
66
+ add_dependencies (check-libclc ${test_target_name} )
67
+ endforeach ()
68
+ endforeach ()
69
+ endif ()
Original file line number Diff line number Diff line change @@ -14,4 +14,11 @@ target_include_directories(libclc-remangler PRIVATE
14
14
${CMAKE_SOURCE_DIR} /../clang/include
15
15
${CMAKE_BINARY_DIR} /tools/clang/include )
16
16
17
- clang_target_link_libraries (libclc-remangler PRIVATE clangBasic )
17
+ clang_target_link_libraries (libclc-remangler
18
+ PRIVATE
19
+ clangAST
20
+ clangBasic
21
+ clangFrontend
22
+ clangTooling
23
+ LLVMOption
24
+ )
You can’t perform that action at this time.
0 commit comments