[clang] [clang] Add __has_feature(swiftcc) that checks whether the target supports the Swift calling convention (PR #72159)

Kuba Mracek via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 13:09:36 PST 2023


https://github.com/kubamracek created https://github.com/llvm/llvm-project/pull/72159

None

>From 09f8ba20b5f17ed65c1c0ebf8264effce7130b9a Mon Sep 17 00:00:00 2001
From: Kuba Mracek <mracek at apple.com>
Date: Mon, 13 Nov 2023 13:07:49 -0800
Subject: [PATCH] [clang] Add __has_feature(swiftcc) that checks whether the
 target supports the Swift calling convention

---
 clang/include/clang/Basic/Features.def | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/include/clang/Basic/Features.def b/clang/include/clang/Basic/Features.def
index da77aee8de36990..f69d52a0c24f88e 100644
--- a/clang/include/clang/Basic/Features.def
+++ b/clang/include/clang/Basic/Features.def
@@ -99,6 +99,9 @@ FEATURE(memory_sanitizer,
 FEATURE(thread_sanitizer, LangOpts.Sanitize.has(SanitizerKind::Thread))
 FEATURE(dataflow_sanitizer, LangOpts.Sanitize.has(SanitizerKind::DataFlow))
 FEATURE(scudo, LangOpts.Sanitize.hasOneOf(SanitizerKind::Scudo))
+FEATURE(swiftcc,
+  PP.getTargetInfo().checkCallingConvention(CC_Swift) ==
+  clang::TargetInfo::CCCR_OK)
 FEATURE(swiftasynccc,
   PP.getTargetInfo().checkCallingConvention(CC_SwiftAsync) ==
   clang::TargetInfo::CCCR_OK)



More information about the cfe-commits mailing list