diff options
author | Nico Weber <nicolasweber@gmx.de> | 2019-06-17 12:10:40 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2019-06-17 12:10:40 +0000 |
commit | 37b753368238cd25868632960f477d25f973b977 (patch) | |
tree | 3e53c6db11008c0e6e6d2d418deb2084b383f9da /clang/lib/Driver/ToolChains/Clang.cpp | |
parent | 83773b77a5a45592426a2e8011a36dc1fa19aedc (diff) | |
download | bcm5719-llvm-37b753368238cd25868632960f477d25f973b977.tar.gz bcm5719-llvm-37b753368238cd25868632960f477d25f973b977.zip |
Promote -fdebug-compilation-dir from a cc1 flag to clang and clang-cl driver flags
The flag is useful when wanting to create .o files that are independent
from the absolute path to the build directory. -fdebug-prefix-map= can
be used to the same effect, but it requires putting the absolute path
to the build directory on the build command line, so it still requires
the build command line to be dependent on the absolute path of the build
directory. With this flag, "-fdebug-compilation-dir ." makes it so that
both debug info and the compile command itself are independent of the
absolute path of the build directory, which is good for build
determinism (in the sense that the build is independent of which
directory it happens in) and for caching compile results.
(The tradeoff is that the debugger needs explicit configuration to know
the build directory. See also http://dwarfstd.org/ShowIssue.php?issue=171130.2)
Differential Revision: https://reviews.llvm.org/D63387
llvm-svn: 363548
Diffstat (limited to 'clang/lib/Driver/ToolChains/Clang.cpp')
-rw-r--r-- | clang/lib/Driver/ToolChains/Clang.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index e75c5d1a92e..91993a44007 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -618,7 +618,11 @@ static bool shouldUseLeafFramePointer(const ArgList &Args, /// Add a CC1 option to specify the debug compilation directory. static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs, const llvm::vfs::FileSystem &VFS) { - if (llvm::ErrorOr<std::string> CWD = VFS.getCurrentWorkingDirectory()) { + if (Arg *A = Args.getLastArg(options::OPT_fdebug_compilation_dir)) { + CmdArgs.push_back("-fdebug-compilation-dir"); + CmdArgs.push_back(A->getValue()); + } else if (llvm::ErrorOr<std::string> CWD = + VFS.getCurrentWorkingDirectory()) { CmdArgs.push_back("-fdebug-compilation-dir"); CmdArgs.push_back(Args.MakeArgString(*CWD)); } @@ -637,7 +641,8 @@ static void addDebugPrefixMapArg(const Driver &D, const ArgList &Args, ArgString } /// Vectorize at all optimization levels greater than 1 except for -Oz. -/// For -Oz the loop vectorizer is disable, while the slp vectorizer is enabled. +/// For -Oz the loop vectorizer is disabled, while the slp vectorizer is +/// enabled. static bool shouldEnableVectorizerAtOLevel(const ArgList &Args, bool isSlpVec) { if (Arg *A = Args.getLastArg(options::OPT_O_Group)) { if (A->getOption().matches(options::OPT_O4) || |