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

Reid Kleckner rnk at google.com
Tue Oct 14 15:40:04 PDT 2014


================
Comment at: lib/Driver/SanitizerArgs.cpp:178
@@ +177,3 @@
+
+    Arg *DebugRTArg = nullptr;
+    if (Args.hasArg(options::OPT__SLASH_MTd))
----------------
ehsan wrote:
> samsonov wrote:
> > 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.
> When passing "/MTd /MT", /MTd will be ignored.  clang-cl honors that too.  I should actually add a test case for that too.
MSVC generally implements "last flag wins" for conflicting flags, with some exceptions for things like /EH. They warn on it, but we don't because it's been the behavior in gcc for a long time.

http://reviews.llvm.org/D5764






More information about the cfe-commits mailing list