diff options
author | Peter Wu <peter@lekensteyn.nl> | 2017-10-19 23:53:27 +0000 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2017-10-19 23:53:27 +0000 |
commit | cc28d36809ee131966e1bd25939748d9f7cc07a4 (patch) | |
tree | 7be759ba49de0955c38cf3493cee4e936f9cc209 /lib/Frontend/CompilerInvocation.cpp | |
parent | 22b25a6d050b61a793c93450488a1a7c5e2b9e09 (diff) | |
download | clang-cc28d36809ee131966e1bd25939748d9f7cc07a4.tar.gz |
Try to shorten system header paths when using -MD depfiles
GCC tries to shorten system headers in depfiles using its real path
(resolving components like ".." and following symlinks). Mimic this
feature to ensure that the Ninja build tool detects the correct
dependencies when a symlink changes directory levels, see
https://github.com/ninja-build/ninja/issues/1330
An option to disable this feature is added in case "these changed header
paths may conflict with some compilation environments", see
https://gcc.gnu.org/ml/gcc-patches/2012-09/msg00287.html
Note that the original feature request for GCC
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52974) also included paths
preprocessed output (-E) and diagnostics. That is not implemented now
since I am not sure if it breaks something else.
Differential Revision: https://reviews.llvm.org/D37954
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316193 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | lib/Frontend/CompilerInvocation.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 19e26c18bf..42fd2a1331 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1002,6 +1002,7 @@ static void ParseDependencyOutputArgs(DependencyOutputOptions &Opts, Opts.Targets = Args.getAllArgValues(OPT_MT); Opts.IncludeSystemHeaders = Args.hasArg(OPT_sys_header_deps); Opts.IncludeModuleFiles = Args.hasArg(OPT_module_file_deps); + Opts.CanonicalSystemHeaders = !Args.hasArg(OPT_fno_canonical_system_headers); Opts.UsePhonyTargets = Args.hasArg(OPT_MP); Opts.ShowHeaderIncludes = Args.hasArg(OPT_H); Opts.HeaderIncludeOutputFile = Args.getLastArgValue(OPT_header_include_file); |