Author: Leonard Chan
Date: 2021-03-10T16:28:40-08:00
New Revision: 70af0bf6fe462cc16a2e56657d20eeed126d41d0

URL: 
https://github.com/llvm/llvm-project/commit/70af0bf6fe462cc16a2e56657d20eeed126d41d0
DIFF: 
https://github.com/llvm/llvm-project/commit/70af0bf6fe462cc16a2e56657d20eeed126d41d0.diff

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

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.

Differential Revision: https://reviews.llvm.org/D98375

Added: 
    clang/test/Driver/relative-vtables-flag.cpp

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 7e7ad9437a1c..246bdf42a66a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4869,6 +4869,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
   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");

diff  --git a/clang/test/Driver/relative-vtables-flag.cpp 
b/clang/test/Driver/relative-vtables-flag.cpp
new file mode 100644
index 000000000000..1253809e1d42
--- /dev/null
+++ b/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"


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to