Addressed the review comments.

http://reviews.llvm.org/D5764

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  lib/Driver/SanitizerArgs.cpp
  test/Driver/fsanitize.c
Index: include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- include/clang/Basic/DiagnosticDriverKinds.td
+++ include/clang/Basic/DiagnosticDriverKinds.td
@@ -163,9 +163,11 @@
 
 def note_drv_command_failed_diag_msg : Note<
   "diagnostic msg: %0">;
-def note_drv_t_option_is_global :
-  Note<"The last /TC or /TP option takes precedence over earlier instances">;
-  
+def note_drv_t_option_is_global : Note<
+  "The last /TC or /TP option takes precedence over earlier instances">;
+def note_drv_address_sanitizer_debug_runtime : Note<
+  "AddressSanitizer doesn't support linking with debug runtime libraries yet">;
+
 def err_analyzer_config_no_value : Error<
   "analyzer-config option '%0' has a key but no value">;
 def err_analyzer_config_multiple_values : Error<
Index: lib/Driver/SanitizerArgs.cpp
===================================================================
--- lib/Driver/SanitizerArgs.cpp
+++ lib/Driver/SanitizerArgs.cpp
@@ -174,6 +174,20 @@
           D.Diag(diag::err_drv_invalid_value) << A->getAsString(Args) << S;
         }
     }
+
+    Arg *DebugRTArg = nullptr;
+    if (Args.hasArg(options::OPT__SLASH_MTd))
+      DebugRTArg = Args.getLastArg(options::OPT__SLASH_MTd);
+    if (Args.hasArg(options::OPT__SLASH_MDd))
+      DebugRTArg = Args.getLastArg(options::OPT__SLASH_MDd);
+    if (Args.hasArg(options::OPT__SLASH_LDd))
+      DebugRTArg = Args.getLastArg(options::OPT__SLASH_LDd);
+    if (DebugRTArg) {
+      D.Diag(diag::err_drv_argument_not_allowed_with)
+        << DebugRTArg->getAsString(Args)
+        << lastArgumentForKind(D, Args, NeedsAsanRt);
+      D.Diag(diag::note_drv_address_sanitizer_debug_runtime);
+    }
   }
 
   // Parse -link-cxx-sanitizer flag.
Index: test/Driver/fsanitize.c
===================================================================
--- test/Driver/fsanitize.c
+++ test/Driver/fsanitize.c
@@ -153,3 +153,17 @@
 
 // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=function -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSAN-UBSAN-DARWIN
 // CHECK-FSAN-UBSAN-DARWIN: unsupported option '-fsanitize=function' for target 'x86_64-apple-darwin10'
+
+// RUN: %clang_cl -fsanitize=address -c -MDd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL
+// RUN: %clang_cl -fsanitize=address -c -MTd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL
+// RUN: %clang_cl -fsanitize=address -c -LDd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL
+// CHECK-ASAN-DEBUGRTL: error: invalid argument
+// CHECK-ASAN-DEBUGRTL: not allowed with '-fsanitize=address'
+// CHECK-ASAN-DEBUGRTL: note: AddressSanitizer doesn't support linking with debug runtime libraries yet
+
+// RUN: %clang_cl -fsanitize=address -c -MT -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-RELEASERTL
+// RUN: %clang_cl -fsanitize=address -c -MD -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-RELEASERTL
+// 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'
+// CHECK-ASAN-RELEASERTL-NOT: note: AddressSanitizer doesn't support linking with debug runtime libraries yet
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to