[PATCH] D133457: Add Clang driver flags equivalent to cl's /MD, /MT, /MDd, /MTd.

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 9 05:19:32 PDT 2022


hans added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:2209
+def fms_runtime_lib_EQ : Joined<["-"], "fms-runtime-lib=">, Group<f_Group>,
+  Flags<[NoXarchOption, CoreOption]>, HelpText<"Select Windows run-time library">;
 defm delayed_template_parsing : BoolFOption<"delayed-template-parsing",
----------------
Could this also list the allowed options? And maybe it could also have a DocBrief that explains how to use it?


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6480
 
+  // Process Windows runtime flags (equivalent to cl flags /MD, /MDd, /MT, /MTd)
+  if (Triple.isOSWindows()) {
----------------
Could we somehow re-use the logic in Clang::AddClangCLArgs()? Perhaps the main switch from that could be extracted to a function that could be called from here?


================
Comment at: clang/test/Driver/cl-runtime-flags.c:99
+
+// Check for clang versions of the /MD and /MT flags.
+
----------------
If we want these to behave as the /MD and /MT flags, maybe we can re-use the tests for those, so e.g. we'd do:


```
// RUN: %clang_cl -### /MD -- %s 2>&1 | FileCheck -check-prefix=CHECK-MD %s
// RUN: %clang -### -target ... -fms-runtime-lib=dll -- %s 2>&1 | FileCheck -check-prefix=CHECK-MD %s
// CHECK-MD-NOT: "-D_DEBUG"
// CHECK-MD: "-D_MT"
// CHECK-MD: "-D_DLL"
...
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133457/new/

https://reviews.llvm.org/D133457



More information about the cfe-commits mailing list