From 0aa01aa92196c729c0776a04f64ee75f8580c9e2 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Thu, 24 Jul 2014 06:09:19 +0000 Subject: [PATCH] MS ABI: -fno-rtti-data wasn't data-free enough While -fno-rtti-data would correctly avoid referencing the RTTI complete object locator in the VFTable itself, it would emit them anyway. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213841 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MicrosoftCXXABI.cpp | 4 +++- test/CodeGenCXX/microsoft-no-rtti-data.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/MicrosoftCXXABI.cpp b/lib/CodeGen/MicrosoftCXXABI.cpp index a69d4dd3fe..0ab0940f96 100644 --- a/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/lib/CodeGen/MicrosoftCXXABI.cpp @@ -1179,7 +1179,9 @@ void MicrosoftCXXABI::emitVTableDefinitions(CodeGenVTables &CGVT, if (VTable->hasInitializer()) continue; - llvm::Constant *RTTI = getMSCompleteObjectLocator(RD, Info); + llvm::Constant *RTTI = getContext().getLangOpts().RTTIData + ? getMSCompleteObjectLocator(RD, Info) + : nullptr; const VTableLayout &VTLayout = VFTContext.getVFTableLayout(RD, Info->FullOffsetInMDC); diff --git a/test/CodeGenCXX/microsoft-no-rtti-data.cpp b/test/CodeGenCXX/microsoft-no-rtti-data.cpp index d4002c28b1..fded4c91e4 100644 --- a/test/CodeGenCXX/microsoft-no-rtti-data.cpp +++ b/test/CodeGenCXX/microsoft-no-rtti-data.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 %s -fno-rtti-data -triple=i386-pc-win32 -o - -emit-llvm | FileCheck %s // vftable shouldn't have RTTI data in it. +// CHECK-NOT: @"\01??_R4S@@6B@" // CHECK: @"\01??_7S@@6B@" = linkonce_odr unnamed_addr constant [1 x i8*] [i8* bitcast ({{.*}} @"\01??_GS@@UAEPAXI@Z" to i8*)] struct type_info; -- 2.40.0