summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2013-04-04 12:52:04 +0200
committerLuboš Luňák <l.lunak@suse.cz>2013-04-04 13:05:02 +0200
commit996b6fc92b847f70f73cda58f64e5cf438585127 (patch)
treeb110cd2ac935be58f9859bb6f4976b6cb27bed3b /compilerplugins
parent68c314fc80b5dd5be26a7207b3459a2be9625240 (diff)
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
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/pluginhandler.cxx7
1 files changed, 6 insertions, 1 deletions
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 <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/FrontendPluginRegistry.h>
+#include <clang/Lex/PPCallbacks.h>
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -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 )