When running LLDB tests with a separately built copy of libcxx, it may
be necessary to also use the nostdinc++ and cxx-isystem flags, so
that Clang doesn't keep multiple paths to the standard library in its
include search list. This is particularly important when also running
LLDB tests using older versions of clang, which may not deal with
multiple standard libraries properly.
These issues have all been seen in the LLDB matrix green dragon bot,
which ensures that tip-of-trunk LLDBs can debug code compiled with older
versions of Clang/libcxx.
Once this is merged, llvm-zorg can be updated to use the flags. Local
testing has been done by compiling the project with:
-DLLDB_TEST_USER_ARGS="--custom-libcpp=<invalid_path>
We verified that all LLDB tests failed to find standard library files.
Then we fixed the invalid path to point to a proper libcxx, and the
tests passed.
A similar effect could have been accomplished by repurposing either
CXXFLAGS or CXXFLAGS_EXTRAS, but these are already for many different
purposes, so we choose to isolate the new behavior into a new
environment variable.
We also choose to keep the logic of formatting the flags inside the
Makefile, as that's where we can check which compiler is being used, as
it is already done in other places there.
Please don't rely on environment variables to pass arguments to the Make invocation. This makes it really tedious to debug make invocations. Instead, pass these explicitly as part of the make invocation from the builders (packages/Python/lldbsuite/test/builders/).