diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-07-01 22:24:56 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-07-01 22:24:56 +0000 |
commit | f607234fde4ccbdd0899a1ea92703e720dd83a22 (patch) | |
tree | 89c5bf97108475f199b5dc370c950a9cb97fb5dd /clang/test/CodeGenCXX/microsoft-no-rtti-data.cpp | |
parent | 6433f7c84d68039000785d818b2f139354a26f8c (diff) | |
download | bcm5719-llvm-f607234fde4ccbdd0899a1ea92703e720dd83a22.tar.gz bcm5719-llvm-f607234fde4ccbdd0899a1ea92703e720dd83a22.zip |
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
Diffstat (limited to 'clang/test/CodeGenCXX/microsoft-no-rtti-data.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/microsoft-no-rtti-data.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-no-rtti-data.cpp b/clang/test/CodeGenCXX/microsoft-no-rtti-data.cpp new file mode 100644 index 00000000000..015b7e69a8d --- /dev/null +++ b/clang/test/CodeGenCXX/microsoft-no-rtti-data.cpp @@ -0,0 +1,21 @@ +// 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: @"\01??_7S@@6B@" = linkonce_odr unnamed_addr constant [1 x i8*] [i8* bitcast ({{.*}} @"\01??_GS@@UAEPAXI@Z" to i8*)] + +struct type_info; +namespace std { using ::type_info; } + +struct S { + virtual ~S(); +} s; + +struct U : S { + virtual ~U(); +}; + +extern S *getS(); + +const std::type_info &ti = typeid(*getS()); +const U &u = dynamic_cast<U &>(*getS()); +// CHECK: call i8* @__RTDynamicCast(i8* %0, i32 0, i8* bitcast ({{.*}} @"\01??_R0?AUS@@@8" to i8*), i8* bitcast ({{.*}} @"\01??_R0?AUU@@@8" to i8*), i32 1) |