[PATCH] SanitizerArgs: add ability to filter/diagnose unsupported sanitizers.

Peter Collingbourne peter at pcc.me.uk
Thu Oct 24 01:14:13 PDT 2013



================
Comment at: lib/Driver/ToolChains.cpp:300
@@ -299,3 +299,3 @@
   if (Sanitize.needsUbsanRt()) {
     if (isTargetIPhoneOS()) {
       getDriver().Diag(diag::err_drv_clang_unsupported_per_platform)
----------------
Alexey Samsonov wrote:
> Can you move this piece to filterUnsupportedKinds?
I think so.  The logic behind isTargetIPhoneOS() and isTargetIOSSimulator() is in Darwin::AddDeploymentTarget and is rather more complex than my translation (e.g. it checks certain flags).  This branch was untested though, so I'm inclined to change the logic and let Apple folks fix this if it causes a problem.

================
Comment at: lib/Driver/ToolChains.cpp:314
@@ -313,3 +313,3 @@
   if (Sanitize.needsAsanRt()) {
     if (isTargetIPhoneOS() && !isTargetIOSSimulator()) {
       getDriver().Diag(diag::err_drv_clang_unsupported_per_platform)
----------------
Alexey Samsonov wrote:
> Can you move this piece to filterUnsupportedKinds?
Likewise.

================
Comment at: lib/Driver/SanitizerArgs.cpp:231
@@ +230,3 @@
+                                          bool DiagnoseErrors) {
+  if (Kinds & Kind) {
+    Kinds &= ~Kind;
----------------
Alexey Samsonov wrote:
> Do an early return here instead.
Done.

================
Comment at: lib/Driver/SanitizerArgs.cpp:245
@@ +244,3 @@
+        TC.getTriple().getArch() == llvm::Triple::x86_64)) {
+    filterUnsupportedKind(TC, Kinds, Memory, "-fsanitize=memory",
+                          DiagnoseErrors);
----------------
Alexey Samsonov wrote:
> -fsanitize=thread is also unsupported in this case.
Added.


http://llvm-reviews.chandlerc.com/D1990



More information about the cfe-commits mailing list