]> granicus.if.org Git - clang/commitdiff
Reimplement the PPC explicit option checking to be a bit more obvious
authorEric Christopher <echristo@gmail.com>
Tue, 25 Aug 2015 00:59:11 +0000 (00:59 +0000)
committerEric Christopher <echristo@gmail.com>
Tue, 25 Aug 2015 00:59:11 +0000 (00:59 +0000)
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

lib/Basic/Targets.cpp

index ae300214ecf20012db5fe6f26623be32b2c1b437..b78e2817f0e00f3c3da30bf309dffc7219b43484 100644 (file)
@@ -1070,14 +1070,25 @@ bool PPCTargetInfo::handleTargetFeatures(std::vector<std::string> &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;