[libcxx-commits] [PATCH] D85924: [clang][feature] Add cxx_abi_relative_vtable feature

Leonard Chan via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 13 15:06:30 PDT 2020


leonardchan updated this revision to Diff 285506.
leonardchan retitled this revision from "[clang] Add __RELATIVE_CXX_ABI_VTABLES predefine macro" to "[clang][feature] Add cxx_abi_relative_vtable feature".
leonardchan edited the summary of this revision.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85924

Files:
  clang/include/clang/Basic/Features.def
  clang/test/Lexer/has_feature_cxx_abi_relative_vtable.cpp


Index: clang/test/Lexer/has_feature_cxx_abi_relative_vtable.cpp
===================================================================
--- /dev/null
+++ clang/test/Lexer/has_feature_cxx_abi_relative_vtable.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -E %s -triple x86_64-linux-gnu -x c++ -o - | FileCheck %s --check-prefix=NO-RELATIVE-VTABLE
+// RUN: %clang_cc1 -E %s -triple x86_64-linux-gnu -x c++ -fexperimental-relative-c++-abi-vtables -o - | FileCheck %s --check-prefix=RELATIVE-VTABLE
+// RUN: %clang_cc1 -E %s -triple x86_64-linux-gnu -x c++ -fno-experimental-relative-c++-abi-vtables -o - | FileCheck %s --check-prefix=NO-RELATIVE-VTABLE
+// RUN: %clang_cc1 -E %s -triple x86_64-linux-gnu -x c -fexperimental-relative-c++-abi-vtables -o - | FileCheck %s --check-prefix=NO-RELATIVE-VTABLE
+
+#if __has_feature(cxx_abi_relative_vtable)
+int has_relative_vtable();
+#else
+int has_no_relative_vtable();
+#endif
+
+// RELATIVE-VTABLE: has_relative_vtable
+// NO-RELATIVE-VTABLE: has_no_relative_vtable
Index: clang/include/clang/Basic/Features.def
===================================================================
--- clang/include/clang/Basic/Features.def
+++ clang/include/clang/Basic/Features.def
@@ -256,5 +256,7 @@
 EXTENSION(gnu_asm_goto_with_outputs, LangOpts.GNUAsm)
 EXTENSION(matrix_types, LangOpts.MatrixTypes)
 
+FEATURE(cxx_abi_relative_vtable, LangOpts.CPlusPlus && LangOpts.RelativeCXXABIVTables)
+
 #undef EXTENSION
 #undef FEATURE


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85924.285506.patch
Type: text/x-patch
Size: 1448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200813/e0b37040/attachment.bin>


More information about the libcxx-commits mailing list