From 38da1ed9195578aed4edb9d3c9c9eb2587923658 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 27 Jan 2017 10:46:15 +0100 Subject: Make plugin rewriting work on Windows too ...in a somewhat hacked-up way for now (see the TODO comment) Change-Id: Ida89fb8257b876cfca05b3048ce15996091c5703 --- compilerplugins/clang/pluginhandler.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx index b46079bb179f..b6e45c86c8f7 100644 --- a/compilerplugins/clang/pluginhandler.cxx +++ b/compilerplugins/clang/pluginhandler.cxx @@ -191,6 +191,11 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context ) if( plugins[ i ].object != NULL ) plugins[ i ].object->run(); } +#if defined _WIN32 + //TODO: make the call to 'rename' work on Windows (where the renamed-to + // original file is probably still held open somehow): + rewriter.overwriteChangedFiles(); +#else for( Rewriter::buffer_iterator it = rewriter.buffer_begin(); it != rewriter.buffer_end(); ++it ) @@ -256,6 +261,7 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context ) report( DiagnosticsEngine::Error, "cannot write modified source to %0 (%1)" ) << modifyFile << error; delete[] filename; } +#endif } #if CLANG_VERSION >= 30600 -- cgit