[PATCH] D85924: [clang] Add __RELATIVE_CXX_ABI_VTABLES predefine macro

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 13 12:31:02 PDT 2020


leonardchan created this revision.
leonardchan added reviewers: mcgrathr, phosek.
leonardchan added a project: libc++abi.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
leonardchan requested review of this revision.

This will be set if relative vtables are enabled.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85924

Files:
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/test/Preprocessor/predefined-macros.c


Index: clang/test/Preprocessor/predefined-macros.c
===================================================================
--- clang/test/Preprocessor/predefined-macros.c
+++ clang/test/Preprocessor/predefined-macros.c
@@ -199,3 +199,7 @@
 // CHECK-HIP-DEV: #define __HIPCC__ 1
 // CHECK-HIP-DEV: #define __HIP_DEVICE_COMPILE__ 1
 // CHECK-HIP-DEV: #define __HIP__ 1
+
+// RUN: %clang_cc1 %s -E -dM -o - -fexperimental-relative-c++-abi-vtables \
+// RUN:   | FileCheck -match-full-lines %s --check-prefix=CHECK-RELATIVE-VTABLES
+// CHECK-RELATIVE-VTABLES: #define __RELATIVE_CXX_ABI_VTABLES 1
Index: clang/lib/Frontend/InitPreprocessor.cpp
===================================================================
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -1124,6 +1124,9 @@
     Builder.defineMacro("__GLIBCXX_BITSIZE_INT_N_0", "128");
   }
 
+  if (LangOpts.RelativeCXXABIVTables)
+    Builder.defineMacro("__RELATIVE_CXX_ABI_VTABLES");
+
   // Get other target #defines.
   TI.getTargetDefines(LangOpts, Builder);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85924.285464.patch
Type: text/x-patch
Size: 1059 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200813/e4bcaac6/attachment-0001.bin>


More information about the cfe-commits mailing list