[Driver] Only check -nostdinc++ for -stdlib++-isystem
authorShoaib Meenai <smeenai@fb.com>
Thu, 1 Dec 2022 00:45:08 +0000 (16:45 -0800)
committerShoaib Meenai <smeenai@fb.com>
Thu, 1 Dec 2022 00:55:51 +0000 (16:55 -0800)
commit658a5039373e3272e9920a07312a013c2f629538
tree530e0499d5d1287a9c06ff318872ccba60dbdba1
parent4eb84582344f97167b6a2b4cb1fb1d75ae07897e
[Driver] Only check -nostdinc++ for -stdlib++-isystem

A drive-by change in 53c98d85a8a609552448043d5512e70313b1eb1b made
-stdlib++-isystem be suppressed by -nostdinc and -nostdlibinc in
addition to -nostdinc++. However, that's contrary to the intent of the
flag. It's common to provide your own C++ headers (e.g. when building
libc++ by itself or as a compiler-rt dependency) but rely on the system
C headers, and having -stdlib++-isystem only look at -nostdinc++ allows
us to customize both the C header path (via -nostdinc or -nostdlibinc)
and the C++ header path (via -stdlib++-isystem) at the toolchain level
but still let users of the toolchain provide their own C++ headers. Add
a comment explaining the rationale to make it clearer.
clang/lib/Driver/ToolChain.cpp
clang/test/Driver/stdlibxx-isystem.cpp