[clang] [flang] [flang] Add MSC_VER and target arch defines when targeting the MSVC ABI (PR #73250)

David Truby via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 30 08:24:03 PST 2023


================
@@ -204,6 +204,29 @@ void Flang::AddAArch64TargetArgs(const ArgList &Args,
   }
 }
 
+static void addVSDefines(const ToolChain &TC, const ArgList &Args,
+                         ArgStringList &CmdArgs) {
+
+  unsigned ver = 0;
+  const VersionTuple vt = TC.computeMSVCVersion(nullptr, Args);
+  ver = vt.getMajor() * 10000000 + vt.getMinor().value_or(0) * 100000 +
+        vt.getSubminor().value_or(0);
+  CmdArgs.push_back(Args.MakeArgString("-D_MSC_VER=" + Twine(ver / 100000)));
+  CmdArgs.push_back(Args.MakeArgString("-D_MSC_FULL_VER=" + Twine(ver)));
+
+  llvm::Triple triple = TC.getTriple();
+  if (triple.isAArch64()) {
+    CmdArgs.push_back("-D_M_ARM64=1");
----------------
DavidTruby wrote:

I don't believe so. It's not tested at all if it does as far as I can tell!

https://github.com/llvm/llvm-project/pull/73250


More information about the cfe-commits mailing list