r334153 - Change the wording of RTTI errors to make them more generic.

Sunil Srivastava via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 6 17:42:59 PDT 2018


Author: ssrivastava
Date: Wed Jun  6 17:42:59 2018
New Revision: 334153

URL: http://llvm.org/viewvc/llvm-project?rev=334153&view=rev
Log:
Change the wording of RTTI errors to make them more generic.

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

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/test/SemaCXX/no-rtti.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=334153&r1=334152&r2=334153&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jun  6 17:42:59 2018
@@ -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">;

Modified: cfe/trunk/test/SemaCXX/no-rtti.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/no-rtti.cpp?rev=334153&r1=334152&r2=334153&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/no-rtti.cpp (original)
+++ cfe/trunk/test/SemaCXX/no-rtti.cpp Wed Jun  6 17:42:59 2018
@@ -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) {




More information about the cfe-commits mailing list