[PATCH] D110139: [flang] Change complex type define in runtime for clang-cl

Diana Picus via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 21 02:37:31 PDT 2021


rovka created this revision.
rovka added reviewers: klausler, jeanPerier, Meinersbur.
rovka added a project: Flang.
Herald added a subscriber: jdoerfert.
rovka requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When compiling the runtime with a version of clang-cl newer than 12, we
define CMPLXF as __builtin_complex, which returns a float _Complex type.
This errors out in contexts where the result of CMPLXF is expected to be
a float_Complex_t. This is defined as _Fcomplex whenever _MSC_VER is
defined and as float _Complex otherwise.

This patch defines float_Complex_t & friends as _Fcomplex only when
we're using "true" MSVC, and not just clang-pretending-to-be-MSVC. This
should only affect clang-cl >= 12.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110139

Files:
  flang/runtime/complex-reduction.h


Index: flang/runtime/complex-reduction.h
===================================================================
--- flang/runtime/complex-reduction.h
+++ flang/runtime/complex-reduction.h
@@ -20,7 +20,7 @@
 
 struct CppDescriptor; /* dummy type name for Fortran::runtime::Descriptor */
 
-#ifdef _MSC_VER
+#if defined _MSC_VER && ! __clang_major__ >= 12
 typedef _Fcomplex float_Complex_t;
 typedef _Dcomplex double_Complex_t;
 typedef _Lcomplex long_double_Complex_t;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110139.373821.patch
Type: text/x-patch
Size: 466 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210921/35ffe6e0/attachment.bin>


More information about the llvm-commits mailing list