]> granicus.if.org Git - clang/commitdiff
Change the wording of RTTI errors to make them more generic.
authorSunil Srivastava <sunil_srivastava@playstation.sony.com>
Thu, 7 Jun 2018 00:42:59 +0000 (00:42 +0000)
committerSunil Srivastava <sunil_srivastava@playstation.sony.com>
Thu, 7 Jun 2018 00:42:59 +0000 (00:42 +0000)
An attempt to use dynamic_cast while rtti is disabled, used to emit the error:

  cannot use dynamic_cast with -fno-rtti

and a similar one for typeid.

This patch changes that to:

  use of dynamic_cast requires -frtti

Differential Revision: https://reviews.llvm.org/D47291

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334153 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
test/SemaCXX/no-rtti.cpp

index 16836b98614824d826ddcab7615e9016ebc4c4c7..e0050d68392e0cb74a985973b05f11de422a46f8 100644 (file)
@@ -6607,9 +6607,9 @@ def err_not_tag_in_scope : Error<
   "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
 
 def err_no_typeid_with_fno_rtti : Error<
-  "cannot use typeid with -fno-rtti">;
+  "use of typeid requires -frtti">;
 def err_no_dynamic_cast_with_fno_rtti : Error<
-  "cannot use dynamic_cast with -fno-rtti">;
+  "use of dynamic_cast requires -frtti">;
 
 def err_cannot_form_pointer_to_member_of_reference_type : Error<
   "cannot form a pointer-to-member to member %0 of reference type %1">;
index a171b3cde2c36cf41b765d4b8e70dcfb43c6b7c9..e0b57153c24c9b6b224db5f80501753d1f968b26 100644 (file)
@@ -6,7 +6,7 @@ namespace std {
 
 void f()
 {
-  (void)typeid(int); // expected-error {{cannot use typeid with -fno-rtti}}
+  (void)typeid(int); // expected-error {{use of typeid requires -frtti}}
 }
 
 namespace {
@@ -20,7 +20,7 @@ struct B : public A {
 }
 
 bool isa_B(A *a) {
-  return dynamic_cast<B *>(a) != 0; // expected-error {{cannot use dynamic_cast with -fno-rtti}}
+  return dynamic_cast<B *>(a) != 0; // expected-error {{use of dynamic_cast requires -frtti}}
 }
 
 void* getMostDerived(A* a) {