[PATCH] D85802: [clang] Add -fc++-abi= flag for specifying which C++ ABI to use

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 28 00:01:05 PDT 2021


phosek added inline comments.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:4001
+  // probably don't want to allow usage of an ARM ABI on an x86 architecture.
+  auto SupportedCXXABI = [](const llvm::Triple &T, TargetCXXABI::Kind Kind) {
+    switch (Kind) {
----------------
I'd consider extracting this into a method.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:4004-4009
+    case TargetCXXABI::iOS:
+    case TargetCXXABI::WatchOS:
+      return T.isARM() || T.isAArch64();
+
+    case TargetCXXABI::AppleARM64:
+      return T.isARM() && T.isArch64Bit();
----------------
These should probably be only supported on Apple platforms?


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:4012
+    case TargetCXXABI::Fuchsia:
+      return T.isAArch64() || (T.isX86() && T.isArch64Bit());
+
----------------
I think you should be checking OS here, not the architecture since we want to use the same ABI across all architectures.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85802



More information about the cfe-commits mailing list