Driver: Handle /GR- in a compatible way with MSVC
There are slight differences between /GR- and -fno-rtti which made
mapping one to the other inappropriate.
-fno-rtti disables dynamic_cast, typeid, and does not emit RTTI related
information for the v-table.
/GR- does not generate complete object locators and thus will not
reference them in vftables. However, constructs like dynamic_cast and
typeid are permitted.
This should bring our implementation of RTTI up to semantic parity with
MSVC modulo bugs.
llvm-svn: 212138
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
index 2e9db03..5dc0752 100644
--- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -1152,7 +1152,7 @@
llvm::GlobalValue::ExternalLinkage;
llvm::ArrayType *VTableType =
llvm::ArrayType::get(CGM.Int8PtrTy, NumVTableSlots);
- if (getContext().getLangOpts().RTTI) {
+ if (getContext().getLangOpts().RTTIData) {
VTableLinkage = llvm::GlobalValue::PrivateLinkage;
VTableName = "";
}
@@ -1163,7 +1163,8 @@
CGM.getModule(), VTableType, /*isConstant=*/true, VTableLinkage,
/*Initializer=*/nullptr, VTableName);
VTable->setUnnamedAddr(true);
- if (getContext().getLangOpts().RTTI && !RD->hasAttr<DLLImportAttr>()) {
+ if (getContext().getLangOpts().RTTIData &&
+ !RD->hasAttr<DLLImportAttr>()) {
llvm::Value *GEPIndices[] = {llvm::ConstantInt::get(CGM.IntTy, 0),
llvm::ConstantInt::get(CGM.IntTy, 1)};
llvm::Constant *VTableGEP =