summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-08-13 17:56:49 +0000
committerReid Kleckner <rnk@google.com>2015-08-13 17:56:49 +0000
commit6cf4a6ba9b3fb7d0b2eab26c35146b5ab3c3c8be (patch)
tree13c5628c358bf2544f879b56834a82099e3f4a82 /clang
parent1c39ca6501a5c9259a166a03fceb049d886cbea4 (diff)
downloadbcm5719-llvm-6cf4a6ba9b3fb7d0b2eab26c35146b5ab3c3c8be.tar.gz
bcm5719-llvm-6cf4a6ba9b3fb7d0b2eab26c35146b5ab3c3c8be.zip
Turn off __has_feature(cxx_rtti) when -fno-rtti-data is present
-fno-rtti-data makes it so that vtables emitted in the current TU lack RTTI data. This means that dynamic_cast usually fails at runtime. Users of the existing cxx_rtti feature expect all of RTTI to work, not just some of it. Chromium bug for context: http://crbug.com/518191 llvm-svn: 244922
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp2
-rw-r--r--clang/test/Lexer/has_feature_rtti.cpp1
2 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 42b1d048c40..594365b45e1 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -1076,7 +1076,7 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) {
.Case("blocks", LangOpts.Blocks)
.Case("c_thread_safety_attributes", true)
.Case("cxx_exceptions", LangOpts.CXXExceptions)
- .Case("cxx_rtti", LangOpts.RTTI)
+ .Case("cxx_rtti", LangOpts.RTTI && LangOpts.RTTIData)
.Case("enumerator_attributes", true)
.Case("nullability", true)
.Case("memory_sanitizer", LangOpts.Sanitize.has(SanitizerKind::Memory))
diff --git a/clang/test/Lexer/has_feature_rtti.cpp b/clang/test/Lexer/has_feature_rtti.cpp
index 4bfeead3299..26eaa2ead62 100644
--- a/clang/test/Lexer/has_feature_rtti.cpp
+++ b/clang/test/Lexer/has_feature_rtti.cpp
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-RTTI %s
// RUN: %clang_cc1 -E -fno-rtti %s -o - | FileCheck --check-prefix=CHECK-NO-RTTI %s
+// RUN: %clang_cc1 -E -fno-rtti-data %s -o - | FileCheck --check-prefix=CHECK-NO-RTTI %s
#if __has_feature(cxx_rtti)
int foo();
OpenPOWER on IntegriCloud