1
- # The following cause errors if they are passed to clang via CFLAGS
2
- set (CLANG_ERRORING_CFLAGS
3
- "-fno-early-inlining"
4
- "-fno-ira-share-spill-slots"
5
- "-ftree-loop-distribution"
6
- "-fno-tree-bit-ccp"
7
- "-fno-tree-coalesce-vars"
8
- )
9
-
10
- # This pulls out options in dg-options into `${Variable}`
11
- function (gcc_torture_dg_options_cflags Variable File)
12
- # Some files have dg-options which we need to pick up. These should be in
13
- # the first line but often aren't.
14
- #
15
- # We also need to be careful not to pick up target-specific dg-options.
16
- set (DG_CFLAGS)
17
-
18
- file (STRINGS ${File} FileLines)
19
- foreach (FileLine ${FileLines} )
20
- # Looking for `dg-options "..."` or `dg-additional-options "..."` without
21
- # `{ target` afterwards (ignoring spaces).
22
- if (FileLine MATCHES "dg-(additional-)?options ({ )?\" ([^\" ]*)\" ( })?(.*)" )
23
- # This is needed to turn the string into a list of CFLAGS
24
- separate_arguments (FILE_CFLAGS UNIX_COMMAND ${CMAKE_MATCH_3} )
25
- # This does the negative lookahead for `{ target` anywhere in the rest of
26
- # the line
27
- if (NOT ${CMAKE_MATCH_5} MATCHES "{ +target" )
28
- list (APPEND DG_CFLAGS ${FILE_CFLAGS} )
29
- endif ()
30
- endif ()
31
- endforeach ()
32
-
33
- # Remove any flags that will make clang error
34
- if (DG_CFLAGS)
35
- list (REMOVE_ITEM DG_CFLAGS ${CLANG_ERRORING_CFLAGS} )
36
- endif ()
37
-
38
- # Set the parent scope variable
39
- set (${Variable} ${DG_CFLAGS} PARENT_SCOPE)
40
- endfunction ()
41
-
42
- function (gcc_torture_execute_test File)
43
- cmake_parse_arguments (_TORTURE "" "PREFIX" "CFLAGS;LDFLAGS" ${ARGN} )
44
- # There are a few tests with duplicate filenames, and CMake wants all target
45
- # names to be unique, so we add a disambiguator to the target name. The
46
- # disambiguator is based upon the directory structure, swapping `/` for `-`.
47
- get_filename_component (Name ${File} NAME_WE )
48
- set (_target "${_TORTURE_PREFIX} -${Name} " )
49
-
50
- gcc_torture_dg_options_cflags(DG_CFLAGS ${File} )
51
-
52
- # Add any flags that were requested
53
- list (APPEND CFLAGS ${DG_CFLAGS} ${_TORTURE_CFLAGS} )
54
- list (APPEND LDFLAGS ${_TORTURE_LDFLAGS} )
55
-
56
- llvm_test_executable_no_test(${_target} ${File} )
57
- llvm_test_run()
58
-
59
- llvm_add_test_for_target(${_target} )
60
- endfunction ()
1
+ include (${CMAKE_CURRENT_SOURCE_DIR} /../../DgOptions.txt)
61
2
62
3
file (COPY lit.local.cfg DESTINATION "${CMAKE_CURRENT_BINARY_DIR} " )
63
4
64
- add_subdirectory (execute)
5
+ add_subdirectory (execute)
0 commit comments