From 996b6fc92b847f70f73cda58f64e5cf438585127 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Thu, 4 Apr 2013 12:52:04 +0200 Subject: don't explicitly delete PPCallbacks-based compiler plugin actions If the class is based on PPCallbacks too, Clang internals will delete the instance. Change-Id: I6dd83d800e6cca17eb0b5de23c8994f11c087fd5 --- compilerplugins/clang/pluginhandler.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx index 69b8c04466a4..cd554aac97e7 100644 --- a/compilerplugins/clang/pluginhandler.cxx +++ b/compilerplugins/clang/pluginhandler.cxx @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -65,7 +66,11 @@ PluginHandler::~PluginHandler() i < pluginCount; ++i ) if( plugins[ i ].object != NULL ) - delete plugins[ i ].object; + { + // PPCallbacks is owned by preprocessor object, don't delete those + if( dynamic_cast< PPCallbacks* >( plugins[ i ].object ) == NULL ) + delete plugins[ i ].object; + } } void PluginHandler::handleOption( const string& option ) -- cgit v1.2.3