clang-cl: Add a `/showIncludes:user` flag.
authorNico Weber <thakis@chromium.org>
Mon, 24 Feb 2020 21:07:16 +0000 (16:07 -0500)
committerNico Weber <thakis@chromium.org>
Tue, 25 Feb 2020 14:43:52 +0000 (09:43 -0500)
commitbcda1269c4c4d5d19d2be425c0a52d19fe09f146
tree9047e1c64d2d8797c4e51ab73c6a9d45180d7080
parente5513336aee4a9b10cb98f234145aeb4763fdd69
clang-cl: Add a `/showIncludes:user` flag.

This flag is like /showIncludes, but it only includes user headers and
omits system headers (similar to MD and MMD). The motivation is that
projects that already track system includes though other means can use
this flag to get consistent behavior on Windows and non-Windows, and it
saves tools that output /showIncludes output (e.g. ninja) some work.

implementation-wise, this makes `HeaderIncludesCallback` honor the
existing `IncludeSystemHeaders` bit, and changes the three clients of
`HeaderIncludesCallback` (`/showIncludes`, `-H`, `CC_PRINT_HEADERS=1`)
to pass `-sys-header-deps` to set that bit -- except for
`/showIncludes:user`, which doesn't pass it.

Differential Revision: https://reviews.llvm.org/D75093
clang/include/clang/Driver/CLCompatOptions.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/DependencyFile.cpp
clang/lib/Frontend/HeaderIncludeGen.cpp
clang/test/Driver/cl-options.c
clang/test/Frontend/print-header-includes.c
clang/test/Preprocessor/headermap-rel2.c