[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
Tue Sep 13 18:20:39 PDT 2022


hans added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4442
+                                    bool IsClangCL) {
+  unsigned RTOptionID = 0; // MT=0, MTd=1, MD=2, MDd=3
+  bool HasLDdFlag = IsClangCL && Args.hasArg(options::OPT__SLASH_LDd);
----------------
Could this be an enum, or reuse existing values like the /Mx option ids?


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4443
+  unsigned RTOptionID = 0; // MT=0, MTd=1, MD=2, MDd=3
+  bool HasLDdFlag = IsClangCL && Args.hasArg(options::OPT__SLASH_LDd);
+
----------------
The `IsClangCL &&` part seems redundant?


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4445
+
+  if (Args.hasArg(options::OPT__SLASH_LDd))
+    // The /LDd option implies /MTd. The dependent lib part can be overridden,
----------------
Should this use HasLDdFlag?


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4461
+  } else {
+    if (Arg *A = Args.getLastArg(options::OPT_fms_runtime_lib_EQ)) {
+      StringRef Val = A->getValue();
----------------
Is there a getLastArg() variant that allows getting the last argument of either the /Mx options or -fms-runtime-lib, so we don't need to check IsClangCL?


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