diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-12-05 13:37:12 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-12-05 13:37:12 +0000 |
commit | 99469f732efbd6600dfd0a70e0a36116a717dd06 (patch) | |
tree | dc446bff420f5c0bc69bd8596c92168c37aa4e8c /lib/Driver/Tools.cpp | |
parent | 9ec98f26633ccbae8a8865f6fc6f08302f9eb518 (diff) |
Reuse an existing diagnostic for tsan/msan needing -pie error.
Add a diagnosting for -fsanitize=memory conflicting with other sanitizers.
Extend tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169380 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index d5f191cf8a..911a9dc512 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1472,10 +1472,19 @@ SanitizerArgs::SanitizerArgs(const Driver &D, const ArgList &Args) { // Only one runtime library can be used at once. bool NeedsAsan = needsAsanRt(); bool NeedsTsan = needsTsanRt(); + bool NeedsMsan = needsMsanRt(); if (NeedsAsan && NeedsTsan) D.Diag(diag::err_drv_argument_not_allowed_with) << lastArgumentForKind(D, Args, NeedsAsanRt) << lastArgumentForKind(D, Args, NeedsTsanRt); + if (NeedsAsan && NeedsMsan) + D.Diag(diag::err_drv_argument_not_allowed_with) + << lastArgumentForKind(D, Args, NeedsAsanRt) + << lastArgumentForKind(D, Args, NeedsMsanRt); + if (NeedsTsan && NeedsMsan) + D.Diag(diag::err_drv_argument_not_allowed_with) + << lastArgumentForKind(D, Args, NeedsTsanRt) + << lastArgumentForKind(D, Args, NeedsMsanRt); // If -fsanitize contains extra features of ASan, it should also // explicitly contain -fsanitize=address. @@ -1545,8 +1554,8 @@ static void addTsanRTLinux(const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs) { if (!Args.hasArg(options::OPT_shared)) { if (!Args.hasArg(options::OPT_pie)) - TC.getDriver().Diag(diag::err_drv_sanitizer_requires_pie) << - /* Thread */ 0; + TC.getDriver().Diag(diag::err_drv_argument_only_allowed_with) << + "-fsanitize=thread" << "-pie"; // LibTsan is "libclang_rt.tsan-<ArchName>.a" in the Linux library // resource directory. SmallString<128> LibTsan(TC.getDriver().ResourceDir); @@ -1566,8 +1575,8 @@ static void addMsanRTLinux(const ToolChain &TC, const ArgList &Args, ArgStringList &CmdArgs) { if (!Args.hasArg(options::OPT_shared)) { if (!Args.hasArg(options::OPT_pie)) - TC.getDriver().Diag(diag::err_drv_sanitizer_requires_pie) << - /* Memory */ 1; + TC.getDriver().Diag(diag::err_drv_argument_only_allowed_with) << + "-fsanitize=memory" << "-pie"; // LibMsan is "libclang_rt.msan-<ArchName>.a" in the Linux library // resource directory. SmallString<128> LibMsan(TC.getDriver().ResourceDir); |