From: Eric Christopher Date: Tue, 25 Aug 2015 00:59:11 +0000 (+0000) Subject: Reimplement the PPC explicit option checking to be a bit more obvious X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f3c0be005e4d09e47b4842b143f4a2455ee5948a;p=clang Reimplement the PPC explicit option checking to be a bit more obvious that we're looking for conflicting options and give an explanation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245914 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index ae300214ec..b78e2817f0 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -1070,14 +1070,25 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector &Features, // TODO: Finish this list and add an assert that we've handled them // all. } - if (!HasVSX && (HasP8Vector || HasDirectMove)) { - if (HasP8Vector) - Diags.Report(diag::err_opt_not_valid_with_opt) << "-mpower8-vector" << - "-mno-vsx"; - else if (HasDirectMove) - Diags.Report(diag::err_opt_not_valid_with_opt) << "-mdirect-move" << - "-mno-vsx"; - return false; + + // Handle explicit options being passed to the compiler here: if we've + // explicitly turned off vsx and turned on power8-vector or direct-move then + // go ahead and error since the customer has expressed a somewhat incompatible + // set of options. + if (std::find(Features.begin(), Features.end(), "-vsx") != Features.end()) { + if (std::find(Features.begin(), Features.end(), "+power8-vector") != + Features.end()) { + Diags.Report(diag::err_opt_not_valid_with_opt) << "-mpower8-vector" + << "-mno-vsx"; + return false; + } + + if (std::find(Features.begin(), Features.end(), "+direct-move") != + Features.end()) { + Diags.Report(diag::err_opt_not_valid_with_opt) << "-mdirect-move" + << "-mno-vsx"; + return false; + } } return true;