@@ -25,11 +25,29 @@ function RegisterExtractorPack(id)
2525 end
2626 end
2727
28+ -- removes unsupported -Xcc flag, e.g, calling strip_unsupported_xcc_arg('-foo', 2) against
29+ -- swift -Xcc -foo -Xcc -bar main.swift
30+ -- will only leave 'swift main.swift' removing both -Xcc -foo, and also -Xcc -bar
31+ -- removes unsupported CLI arg passed to clang via -Xcc together with the following how_many args
32+ function strip_unsupported_clang_arg (args , arg , how_many )
33+ local index = indexOf (args , arg )
34+ if index and index > 0 and args [index - 1 ] == ' -Xcc' then
35+ index = index - 1 -- start from -Xcc
36+ how_many = 2 * (how_many + 1 ) -- need to remove initial -Xcc <arg> as well as following -Xcc prefixed flags
37+ while (how_many > 0 )
38+ do
39+ table.remove (args , index )
40+ how_many = how_many - 1
41+ end
42+ end
43+ end
44+
2845 function strip_unsupported_args (args )
2946 strip_unsupported_arg (args , ' -emit-localized-strings' , 0 )
3047 strip_unsupported_arg (args , ' -emit-localized-strings-path' , 1 )
3148 strip_unsupported_arg (args , ' -stack-check' , 0 )
3249 strip_unsupported_arg (args , ' -experimental-skip-non-inlinable-function-bodies-without-types' , 0 )
50+ strip_unsupported_clang_arg (args , ' -ivfsstatcache' , 1 )
3351 end
3452
3553 -- xcodebuild does not always specify the -resource-dir in which case the compiler falls back
0 commit comments