summaryrefslogtreecommitdiff
path: root/lib/Driver/ToolChain.cpp
diff options
context:
space:
mode:
authorSterling Augustine <saugustine@google.com>2019-01-28 18:56:43 +0000
committerSterling Augustine <saugustine@google.com>2019-01-28 18:56:43 +0000
commit64145a1e2e25129c4b6e90c5e60637119e8ea39d (patch)
tree8ad3b7cab30e6188a50aa4c9c24946f94043333d /lib/Driver/ToolChain.cpp
parent5cc8b40460b34dece34bf972a1632148185171b3 (diff)
downloadclang-64145a1e2e25129c4b6e90c5e60637119e8ea39d.tar.gz
Add --unwindlib=[libgcc|compiler-rt] to parallel --rtlib=
Summary: "clang++ hello.cc --rtlib=compiler-rt" now works without specifying additional unwind or exception handling libraries. Reviewers: rsmith Subscribers: srhines, dberris, aheejin, llvm-commits Differential Revision: https://reviews.llvm.org/D57128 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352404 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChain.cpp')
-rw-r--r--lib/Driver/ToolChain.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index fcf373e9f7..42d9d91960 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -679,6 +679,33 @@ ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(
return GetDefaultRuntimeLibType();
}
+ToolChain::RuntimeLibType ToolChain
+::GetUnwindLibType(
+ const ArgList &Args) const {
+ const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ);
+ // If nothing has been specified, follow the runtime lib type.
+ if (!A)
+ return GetRuntimeLibType(Args);
+
+ StringRef LibName = A->getValue();
+ if (LibName == "compiler-rt") {
+ if (GetRuntimeLibType(Args) == RLT_Libgcc)
+ getDriver().Diag(diag::err_drv_incompatible_unwindlib);
+ return ToolChain::RLT_CompilerRT;
+ }
+ else if (LibName == "libgcc")
+ return ToolChain::RLT_Libgcc;
+ else if (LibName == "platform") {
+ return GetRuntimeLibType(Args);
+ }
+
+ 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;