diff options
| author | Sterling Augustine <saugustine@google.com> | 2019-03-19 20:01:59 +0000 |
|---|---|---|
| committer | Sterling Augustine <saugustine@google.com> | 2019-03-19 20:01:59 +0000 |
| commit | 344aa82a52f2fae527f58284567ae305a314f7a8 (patch) | |
| tree | 5d41cdad4466d4947b27b853c16b636f49e96cac /lib/Driver/ToolChain.cpp | |
| parent | 98a21c18f23597a8fb89d89a33888fa72a74b28d (diff) | |
| download | clang-344aa82a52f2fae527f58284567ae305a314f7a8.tar.gz | |
Add --unwindlib=[libgcc|compiler-rt] to parallel --rtlib= [take 2]
"clang++ hello.cc --rtlib=compiler-rt"
now can works without specifying additional unwind or exception
handling libraries.
This reworked version of the feature no longer modifies today's default
unwind library for compiler-rt: which is nothing. Rather, a user
can specify -DCLANG_DEFAULT_UNWINDLIB=libunwind when configuring
the compiler.
This should address the issues from the previous version.
Update tests for new --unwindlib semantics.
Differential Revision: https://reviews.llvm.org/D59109
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356508 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChain.cpp')
| -rw-r--r-- | lib/Driver/ToolChain.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp index 6b56271570..5dff2b222a 100644 --- a/lib/Driver/ToolChain.cpp +++ b/lib/Driver/ToolChain.cpp @@ -693,6 +693,33 @@ ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType( return GetDefaultRuntimeLibType(); } +ToolChain::UnwindLibType ToolChain::GetUnwindLibType( + const ArgList &Args) const { + const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ); + StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_UNWINDLIB; + + if (LibName == "none") + return ToolChain::UNW_None; + else if (LibName == "platform" || LibName == "") { + ToolChain::RuntimeLibType RtLibType = GetRuntimeLibType(Args); + if (RtLibType == ToolChain::RLT_CompilerRT) + return ToolChain::UNW_None; + else if (RtLibType == ToolChain::RLT_Libgcc) + return ToolChain::UNW_Libgcc; + } else if (LibName == "libunwind") { + if (GetRuntimeLibType(Args) == RLT_Libgcc) + getDriver().Diag(diag::err_drv_incompatible_unwindlib); + return ToolChain::UNW_CompilerRT; + } else if (LibName == "libgcc") + return ToolChain::UNW_Libgcc; + + if (A) + getDriver().Diag(diag::err_drv_invalid_unwindlib_name) + << A->getAsString(Args); + + return GetDefaultUnwindLibType(); +} + ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{ const Arg *A = Args.getLastArg(options::OPT_stdlib_EQ); StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_CXX_STDLIB; |
