diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-08-06 17:57:45 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-08-06 17:59:09 +0200 |
commit | 653cdcf50c760ac026931c156c69cdc791a6f0f5 (patch) | |
tree | ec2047b75b051e42c1f03464c5378ed0be663d37 /compilerplugins/clang | |
parent | 05944477039d68154e5360f0e8baff572eaa7917 (diff) |
error: cannot use dynamic_cast with -fno-rtti
...with recent Clang trunk towards 3.4
Change-Id: Ie0991c7bd560c30551aeaada426382a889b46391
Diffstat (limited to 'compilerplugins/clang')
-rw-r--r-- | compilerplugins/clang/checkconfigmacros.cxx | 1 | ||||
-rw-r--r-- | compilerplugins/clang/plugin.cxx | 4 | ||||
-rw-r--r-- | compilerplugins/clang/plugin.hxx | 5 | ||||
-rw-r--r-- | compilerplugins/clang/pluginhandler.cxx | 6 | ||||
-rw-r--r-- | compilerplugins/clang/pluginhandler.hxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/rtlconstasciimacro.cxx | 1 |
6 files changed, 12 insertions, 7 deletions
diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx index 2377f8f62ec6..91cb2a8e6913 100644 --- a/compilerplugins/clang/checkconfigmacros.cxx +++ b/compilerplugins/clang/checkconfigmacros.cxx @@ -49,6 +49,7 @@ class CheckConfigMacros virtual void Defined( const Token& macroToken, const MacroDirective* info, SourceRange Range ) override; #endif #endif + enum { isPPCallback = true }; private: void checkMacro( const Token& macroToken, SourceLocation location ); std::set< string > configMacros; diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx index 7454144f7dfd..d647cb239aea 100644 --- a/compilerplugins/clang/plugin.cxx +++ b/compilerplugins/clang/plugin.cxx @@ -62,9 +62,9 @@ bool Plugin::ignoreLocation( SourceLocation loc ) return true; } -void Plugin::registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter ) +void Plugin::registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter, bool isPPCallback ) { - PluginHandler::registerPlugin( create, optionName, isRewriter ); + PluginHandler::registerPlugin( create, optionName, isRewriter, isPPCallback ); } unordered_map< const Stmt*, const Stmt* > Plugin::parents; diff --git a/compilerplugins/clang/plugin.hxx b/compilerplugins/clang/plugin.hxx index 56dee27ef913..0b6cb1f693ff 100644 --- a/compilerplugins/clang/plugin.hxx +++ b/compilerplugins/clang/plugin.hxx @@ -47,6 +47,7 @@ class Plugin virtual ~Plugin(); virtual void run() = 0; template< typename T > class Registration; + enum { isPPCallback = false }; DiagnosticBuilder report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc = SourceLocation()); static DiagnosticBuilder report( DiagnosticsEngine::Level level, StringRef message, CompilerInstance& compiler, SourceLocation loc = SourceLocation()); @@ -62,7 +63,7 @@ class Plugin const Stmt* parentStmt( const Stmt* stmt ); Stmt* parentStmt( Stmt* stmt ); private: - static void registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter ); + static void registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter, bool isPPCallback ); template< typename T > static Plugin* createHelper( CompilerInstance& compiler, Rewriter& rewriter ); enum { isRewriter = false }; static unordered_map< const Stmt*, const Stmt* > parents; @@ -186,7 +187,7 @@ template< typename T > inline Plugin::Registration< T >::Registration( const char* optionName ) { - registerPlugin( &T::template createHelper< T >, optionName, T::isRewriter ); + registerPlugin( &T::template createHelper< T >, optionName, T::isRewriter, T::isPPCallback ); } } // namespace diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx index e0edae21ddfa..e36a82140be3 100644 --- a/compilerplugins/clang/pluginhandler.cxx +++ b/compilerplugins/clang/pluginhandler.cxx @@ -41,6 +41,7 @@ struct PluginData Plugin* object; const char* optionName; bool isRewriter; + bool isPPCallback; }; const int MAX_PLUGINS = 100; @@ -79,7 +80,7 @@ PluginHandler::~PluginHandler() if( plugins[ i ].object != NULL ) { // PPCallbacks is owned by preprocessor object, don't delete those - if( dynamic_cast< PPCallbacks* >( plugins[ i ].object ) == NULL ) + if( !plugins[ i ].isPPCallback ) delete plugins[ i ].object; } } @@ -123,7 +124,7 @@ void PluginHandler::createPlugin( const string& name ) report( DiagnosticsEngine::Fatal, "unknown plugin tool %0" ) << name; } -void PluginHandler::registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter ) +void PluginHandler::registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter, bool isPPCallback ) { assert( !pluginObjectsCreated ); assert( pluginCount < MAX_PLUGINS ); @@ -131,6 +132,7 @@ void PluginHandler::registerPlugin( Plugin* (*create)( CompilerInstance&, Rewrit plugins[ pluginCount ].object = NULL; plugins[ pluginCount ].optionName = optionName; plugins[ pluginCount ].isRewriter = isRewriter; + plugins[ pluginCount ].isPPCallback = isPPCallback; ++pluginCount; } diff --git a/compilerplugins/clang/pluginhandler.hxx b/compilerplugins/clang/pluginhandler.hxx index ef960d1ff2b5..d042c553a704 100644 --- a/compilerplugins/clang/pluginhandler.hxx +++ b/compilerplugins/clang/pluginhandler.hxx @@ -29,7 +29,7 @@ class PluginHandler PluginHandler( CompilerInstance& compiler, const vector< string >& args ); virtual ~PluginHandler(); virtual void HandleTranslationUnit( ASTContext& context ) override; - static void registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter ); + static void registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter, bool isPPCallback ); private: void handleOption( const string& option ); void createPlugin( const string& name ); diff --git a/compilerplugins/clang/rtlconstasciimacro.cxx b/compilerplugins/clang/rtlconstasciimacro.cxx index d3843149b2ea..1036897b1aed 100644 --- a/compilerplugins/clang/rtlconstasciimacro.cxx +++ b/compilerplugins/clang/rtlconstasciimacro.cxx @@ -39,6 +39,7 @@ class RtlConstAsciiMacro virtual void MacroExpands( const Token& macro, const MacroDirective* directive, SourceRange range, const MacroArgs* args ) override; #endif + enum { isPPCallback = true }; private: map< SourceLocation, SourceLocation > expansions; // start location -> end location bool searchingForString; |