summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compilerplugins/clang/pluginhandler.cxx6
-rw-r--r--solenv/gbuild/LinkTarget.mk79
-rw-r--r--solenv/gbuild/platform/com_GCC_class.mk74
3 files changed, 85 insertions, 74 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
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 3b9a0d52a791..ca1f5ad7c42a 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -73,6 +73,85 @@ gb_LinkTarget_LAYER_LINKPATHS := \
NONE:URELIB+OOO+NONE. \
+# Used to run a compiler plugin tool.
+#
+# At least for now, these definitions are generic enough so that they can be
+# shared across all current use cases (COMPILER_EXTERNAL_TOOL,
+# COMPILER_PLUGIN_TOOL) on all relevant toolchains (GCC?, Clang, clang-cl). If
+# it ever becomes necessary, they can be moved to e.g.
+# platform/com_{GCC,MSC}_class.mk and made different there.
+#
+# $(call gb_CObject__tool_command,relative-source,source)
+define gb_CObject__tool_command
+$(call gb_Output_announce,$(1).c,$(true),C ,3)
+$(call gb_Helper_abbreviate_dirs,\
+ ICECC=no CCACHE_DISABLE=1 \
+ $(gb_CC) \
+ $(DEFS) \
+ $(gb_LTOFLAGS) \
+ $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
+ $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
+ $(gb_COMPILER_PLUGINS) \
+ $(T_CFLAGS) $(T_CFLAGS_APPEND) \
+ $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
+ -c $(2) \
+ -I$(dir $(2)) \
+ $(INCLUDE) \
+ )
+endef
+define gb_ObjCObject__tool_command
+$(call gb_Output_announce,$(1).m,$(true),OCC,3)
+$(call gb_Helper_abbreviate_dirs,\
+ ICECC=no CCACHE_DISABLE=1 \
+ $(gb_CC) \
+ $(DEFS) \
+ $(gb_LTOFLAGS) \
+ $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
+ $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
+ $(gb_COMPILER_PLUGINS) \
+ $(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND) \
+ $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
+ -c $(2) \
+ -I$(dir $(2)) \
+ $(INCLUDE) \
+ )
+endef
+define gb_CxxObject__tool_command
+$(call gb_Output_announce,$(1).cxx,$(true),CXX,3)
+$(call gb_Helper_abbreviate_dirs,\
+ ICECC=no CCACHE_DISABLE=1 \
+ $(gb_CXX) \
+ $(DEFS) \
+ $(gb_LTOFLAGS) \
+ $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
+ $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
+ $(gb_COMPILER_PLUGINS) \
+ $(T_CXXFLAGS) $(T_CXXFLAGS_APPEND) \
+ $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
+ -c $(2) \
+ -I$(dir $(2)) \
+ $(INCLUDE) \
+ )
+endef
+define gb_ObjCxxObject__tool_command
+$(call gb_Output_announce,$(1).mm,$(true),OCX,3)
+$(call gb_Helper_abbreviate_dirs,\
+ ICECC=no CCACHE_DISABLE=1 \
+ $(gb_CXX) \
+ $(DEFS) \
+ $(gb_LTOFLAGS) \
+ $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
+ $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
+ $(gb_COMPILER_PLUGINS) \
+ $(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND) \
+ $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
+ -c $(2) \
+ -I$(dir $(2)) \
+ $(INCLUDE) \
+ )
+endef
+
+
# Overview of dependencies and tasks of LinkTarget
#
# target task depends on
diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk
index f80336d4237a..b918f9605283 100644
--- a/solenv/gbuild/platform/com_GCC_class.mk
+++ b/solenv/gbuild/platform/com_GCC_class.mk
@@ -67,80 +67,6 @@ $(call gb_Helper_abbreviate_dirs,\
)
endef
-# Used to run a compiler plugin tool.
-# $(call gb_CObject__tool_command,relative-source,source)
-define gb_CObject__tool_command
-$(call gb_Output_announce,$(1).c,$(true),C ,3)
-$(call gb_Helper_abbreviate_dirs,\
- ICECC=no CCACHE_DISABLE=1 \
- $(gb_CC) \
- $(DEFS) \
- $(gb_LTOFLAGS) \
- $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
- $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
- $(gb_COMPILER_PLUGINS) \
- $(T_CFLAGS) $(T_CFLAGS_APPEND) \
- $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
- -c $(2) \
- -I$(dir $(2)) \
- $(INCLUDE) \
- )
-endef
-define gb_ObjCObject__tool_command
-$(call gb_Output_announce,$(1).m,$(true),OCC,3)
-$(call gb_Helper_abbreviate_dirs,\
- ICECC=no CCACHE_DISABLE=1 \
- $(gb_CC) \
- $(DEFS) \
- $(gb_LTOFLAGS) \
- $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
- $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
- $(gb_COMPILER_PLUGINS) \
- $(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND) \
- $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
- -c $(2) \
- -I$(dir $(2)) \
- $(INCLUDE) \
- )
-endef
-
-# Used to run a compiler plugin tool.
-# $(call gb_CxxObject__tool_command,relative-source,source)
-define gb_CxxObject__tool_command
-$(call gb_Output_announce,$(1).cxx,$(true),CXX,3)
-$(call gb_Helper_abbreviate_dirs,\
- ICECC=no CCACHE_DISABLE=1 \
- $(gb_CXX) \
- $(DEFS) \
- $(gb_LTOFLAGS) \
- $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
- $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
- $(gb_COMPILER_PLUGINS) \
- $(T_CXXFLAGS) $(T_CXXFLAGS_APPEND) \
- $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
- -c $(2) \
- -I$(dir $(2)) \
- $(INCLUDE) \
- )
-endef
-define gb_ObjCxxObject__tool_command
-$(call gb_Output_announce,$(1).mm,$(true),OCX,3)
-$(call gb_Helper_abbreviate_dirs,\
- ICECC=no CCACHE_DISABLE=1 \
- $(gb_CXX) \
- $(DEFS) \
- $(gb_LTOFLAGS) \
- $(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
- $(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
- $(gb_COMPILER_PLUGINS) \
- $(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND) \
- $(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
- -c $(2) \
- -I$(dir $(2)) \
- $(INCLUDE) \
- )
-endef
-
define gb_SrsPartTarget__command_dep
$(call gb_Helper_abbreviate_dirs,\
mkdir -p $(dir $(call gb_SrsPartTarget_get_dep_target,$(1))) && cd $(SRCDIR) && \