[PATCH] clang-cl: Diagnose the usage of ASAN with a debug runtime library

Alexey Samsonov vonosmas at gmail.com
Tue Oct 14 13:31:45 PDT 2014


================
Comment at: lib/Driver/SanitizerArgs.cpp:178
@@ +177,3 @@
+
+    Arg *DebugRTArg = nullptr;
+    if (Args.hasArg(options::OPT__SLASH_MTd))
----------------
Can you use the following syntax here?
  if (Arg *WindowsDebugRTArg = Args.getLastArg(options::OPT__SLASH_MTd, options::OPT__SLASH_MDd,
      options::OPT__SLASH_LDd)) {
    D.Diag(...) << ....;
  }

Also, what is MSVC/clang-cl semantics if I pass "/MTd /MT"? Will it pick up the last flag (/MT), or try to link both runtimes?
In the first case we don't need to produce the error.

================
Comment at: test/Driver/fsanitize.c:167
@@ +166,3 @@
+// RUN: %clang_cl -fsanitize=address -c -LD -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-RELEASERTL
+// CHECK-ASAN-RELEASERTL-NOT: error: invalid argument
+// CHECK-ASAN-RELEASERTL-NOT: not allowed with '-fsanitize=address'
----------------
This line is enough here.

http://reviews.llvm.org/D5764






More information about the cfe-commits mailing list