================
@@ -18,7 +18,7 @@
// RUN: c-index-test -test-load-source local %s -include %t.clang.h -fmodules
-fmodules-cache-path=%t.mcp -Xclang -triple -Xclang x86_64-apple-darwin |
FileCheck %s
// FIXME: Still fails on at least some linux boxen.
-// REQUIRES: system-darwin
+// REQUIRES: system-darwin && target={{.*}}-darwin{{.*}}
----------------
pratlucas wrote:
This is a tricky one indeed. It looks like the problem is a conflict between
the target inference that happens by libclang and the target provided by the
`-Xclang` option, which is only used by the internal cc1 invocation.
Having a deeper look into it, `c-index-tests` appears to follow this execution
flow:
1. `c-index-test` uses libclang to get the translation unit for the input file
using `clang_parseTranslationUnit2`.
2. The flow of `clang_parseTranslationUnit2` creates a compiler invocation with
arguments based on the current target information, and includes the arguments
provided by `c-index-test` (via the `-Xclang` arguments).
3. When cc1 is called by the created compiler invocation, it will parse the
target provided by `c-index-test` via `-Xclang` together with other target
information inferred by the compiler invocation.
The issue happens in step #2:
The target argument provided via `-Xclang` is not applied to the libclang
environment at this point, it is only included as an extra argument for the
compiler invocation. This means that when libclang builds target options to
pass on to cc1 it bases them on its own inferred target information, which
doesn't include `c-index-tests`'s `-Xclang` arguments. When the default target
is not compatible with `x86_64-apple-darwin`, libclang includes values to
arguments such as target-cpu which will be rejected by the
`x86_64-apple-darwin` target when cc1 runs.
https://github.com/llvm/llvm-project/pull/130138
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits