summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/pluginhandler.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-01-27 10:46:15 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-01-27 10:46:15 +0100
commit38da1ed9195578aed4edb9d3c9c9eb2587923658 (patch)
tree1852ea0aa5bb7abad272a979710a616b249237fd /compilerplugins/clang/pluginhandler.cxx
parentb61214c91d926ea56f2cae309469da588b3304b1 (diff)
Make plugin rewriting work on Windows too
...in a somewhat hacked-up way for now (see the TODO comment) Change-Id: Ida89fb8257b876cfca05b3048ce15996091c5703
Diffstat (limited to 'compilerplugins/clang/pluginhandler.cxx')
-rw-r--r--compilerplugins/clang/pluginhandler.cxx6
1 files changed, 6 insertions, 0 deletions
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