[PATCH] D98375: [clang][Driver] Expose -fexperimental-relative-c++-abi-vtables flag

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 10 15:53:45 PST 2021


leonardchan created this revision.
leonardchan added reviewers: phosek, mcgrathr.
leonardchan added a project: clang.
leonardchan requested review of this revision.

Initially, this flag was meant to only be used through cc1 and not directly through the clang driver. However, we accidentally ended up using this flag as a driver flag already for selecting multilibs within the fuchsia toolchain. We're currently in an awkward state where it's only accepted as a driver flag when targeting Fuchsia, and all other instances it can only be added via `-Xclang`. Since we're ready to use this in Fuchsia, we can just expose this to the driver for simplicity.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98375

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/relative-vtables-flag.cpp


Index: clang/test/Driver/relative-vtables-flag.cpp
===================================================================
--- /dev/null
+++ clang/test/Driver/relative-vtables-flag.cpp
@@ -0,0 +1,7 @@
+// RUN: %clangxx --target=aarch64-unknown-fuchsia -fexperimental-relative-c++-abi-vtables -c %s -### 2>&1 | FileCheck %s --check-prefix=RV
+// RUN: %clangxx --target=aarch64-unknown-fuchsia -fno-experimental-relative-c++-abi-vtables -c %s -### 2>&1 | FileCheck %s --check-prefix=NO-RV
+// RUN: %clangxx --target=aarch64-unknown-fuchsia -c %s -### 2>&1 | FileCheck %s --check-prefix=NO-RV
+// RUN: %clangxx --target=aarch64-unknown-linux-gnu -c %s -### 2>&1 | FileCheck %s --check-prefix=NO-RV
+
+// RV: "-fexperimental-relative-c++-abi-vtables"
+// NO-RV-NOT: "-fexperimental-relative-c++-abi-vtables"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4869,6 +4869,9 @@
   Args.AddLastArg(CmdArgs, options::OPT_ffine_grained_bitfield_accesses,
                   options::OPT_fno_fine_grained_bitfield_accesses);
 
+  Args.AddLastArg(CmdArgs, options::OPT_fexperimental_relative_cxx_abi_vtables,
+                  options::OPT_fno_experimental_relative_cxx_abi_vtables);
+
   // Handle segmented stacks.
   if (Args.hasArg(options::OPT_fsplit_stack))
     CmdArgs.push_back("-split-stacks");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98375.329794.patch
Type: text/x-patch
Size: 1442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210310/59cb7efd/attachment.bin>


More information about the cfe-commits mailing list