This patch changes the wording of two errors to make them more generic.
An attempt to use dynamic_cast while rtti is disabled, curently emits the error:
cannot use dynamic_cast with -fno-rtti
and a similar one for typeid.
This patch proposes to change that to:
use of dynamic_cast requires enabling RTTI
For targets where the default mode of RTTI is disabled, the current error
message is confusing because the user never used the -fno-rtti option.
This proposal is motivated by the PS4 compiler, whose default is to have RTTI
disabled. However, it is just as clear as the existing diagnostic, and it
may be applicable to other llvm compilers having the have the same default as the
PS4 compiler. It is also more appropriate in cases where the spelling of the
argument (to disable RTTI) is something other than -fno-rtti (for
example, /GR- is the switch to disable RTTI for cl).
I'd prefer to have the way to enable RTTI mentioned in the message. Could we have something like ToolChain::getRTTIMode() and have a "RTTI was on/of" or "RTTI defaulted to on/off"? That way we'd be able to have a message similar to the current one (mentioning "you passed -fno-rtti") on platforms that default to RTTI=on, and have your updated message (possibly with a mention of "use -frtti") on platforms that default to RTTI=off.
(This is a minor usability comment about this patch, I don't consider it a blocker or anything)