Make plugin rewriting work on Windows too

...in a somewhat hacked-up way for now (see the TODO comment)

Change-Id: Ida89fb8257b876cfca05b3048ce15996091c5703
This commit is contained in:
Stephan Bergmann
2017-01-27 10:46:15 +01:00
parent b61214c91d
commit 38da1ed919
3 changed files with 85 additions and 74 deletions

View File

@@ -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