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

Peter Collingbourne peter at pcc.me.uk
Thu Oct 24 15:14:42 PDT 2013



================
Comment at: include/clang/Basic/DiagnosticDriverKinds.td:66
@@ -65,3 +65,1 @@
   "the clang compiler does not support '%0'">;
-def err_drv_clang_unsupported_per_platform : Error<
-  "the clang compiler does not support '%0' on this platform">;
----------------
Alexey Samsonov wrote:
> separate commit?
Yeah, this would go with whichever commit removes the isTargetIOS checks.

================
Comment at: lib/Driver/SanitizerArgs.cpp:261
@@ +260,3 @@
+
+  if (TC.getTriple().getOS() == llvm::Triple::IOS) {
+    filterUnsupportedKind(TC, Kinds, UndefinedGroup | Undefined, Args, A,
----------------
Alexey Samsonov wrote:
> Make sure you agree with glider@ on this part. I think it would be fine to revert this piece to get the patch committed, leave a FIXME, and deal with/refactor this part later.
After investigating how Xcode builds iOS stuff on Darwin I think I've come to the conclusion that the driver sees the wrong triple, so my change wouldn't work. Reverted to be dealt with later.

================
Comment at: lib/Driver/SanitizerArgs.cpp:235
@@ +234,3 @@
+    return;
+
+  Kinds &= ~Kind;
----------------
Alexey Samsonov wrote:
> ditto
Done.

================
Comment at: lib/Driver/SanitizerArgs.cpp:249
@@ +248,3 @@
+                                               bool DiagnoseErrors) {
+  if (!(TC.getTriple().getOS() == llvm::Triple::Linux &&
+        TC.getTriple().getArch() == llvm::Triple::x86_64)) {
----------------
Alexey Samsonov wrote:
> I'd appreciate booleans like "IsLinux", "IsX86" etc. for brevity.
Done.

================
Comment at: include/clang/Driver/SanitizerArgs.h:136
@@ +135,3 @@
+  static void filterUnsupportedKind(const ToolChain &TC, unsigned &Kinds,
+                                    unsigned Kind,
+                                    const llvm::opt::ArgList &Args,
----------------
Alexey Samsonov wrote:
> Kind is actually a Mask. There is no FlagName parameter. Consider fixing parameter names and comment.
Updated.

================
Comment at: lib/Driver/SanitizerArgs.cpp:50
@@ +49,3 @@
+    Add = filterUnsupportedKinds(TC, Add, Args, *I, /*DiagnoseErrors=*/true);
+
+    Add = expandGroups(Add);
----------------
Alexey Samsonov wrote:
> please remove blank lines in added block
Done.


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



More information about the cfe-commits mailing list