Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/Engine/Source/Programs/UnrealBuildTool/Configuration/UEBuildModuleCPP.cs b/Engine/Source/Programs/UnrealBuildTool/Configuration/UEBuildModuleCPP.cs
index 4c0428ad373..6a6d4f71397 100644
--- a/Engine/Source/Programs/UnrealBuildTool/Configuration/UEBuildModuleCPP.cs
+++ b/Engine/Source/Programs/UnrealBuildTool/Configuration/UEBuildModuleCPP.cs
@@ -404,6 +404,10 @@ namespace UnrealBuildTool
// Write all the definitions to a separate file
CreateHeaderForDefinitions(CompileEnvironment, IntermediateDirectory, null, Graph);
+ if (CompileEnvironment.Definitions.Count > 0)
+ {
+ CompileEnvironment.Definitions.Clear();
+ }
// Mapping of source file to unity file. We output this to intermediate directories for other tools (eg. live coding) to use.
Dictionary<FileItem, FileItem> SourceFileToUnityFile = new Dictionary<FileItem, FileItem>();
@@ -874,6 +878,10 @@ namespace UnrealBuildTool
{
// Write all the definitions out to a separate file
CreateHeaderForDefinitions(CompileEnvironment, IntermediateDirectory, "Adaptive", Graph);
+ if (CompileEnvironment.Definitions.Count > 0)
+ {
+ CompileEnvironment.Definitions.Clear();
+ }
// Compile the files
return ToolChain.CompileCPPFiles(CompileEnvironment, Files, IntermediateDirectory, ModuleName, Graph);
@@ -886,6 +894,10 @@ namespace UnrealBuildTool
// Write all the definitions out to a separate file
CreateHeaderForDefinitions(CompileEnvironment, IntermediateDirectory, "Adaptive", Graph);
+ if (CompileEnvironment.Definitions.Count > 0)
+ {
+ CompileEnvironment.Definitions.Clear();
+ }
// Compile the files
return ToolChain.CompileCPPFiles(CompileEnvironment, Files, IntermediateDirectory, ModuleName, Graph);
@@ -1001,7 +1013,7 @@ namespace UnrealBuildTool
}
CompileEnvironment = new CppCompileEnvironment(CompileEnvironment);
- CompileEnvironment.Definitions.Clear();
+ // CompileEnvironment.Definitions.Clear(); // @todo: Do not clear definitions prior to end of their usefulness
CompileEnvironment.ForceIncludeFiles.Add(PrivateDefinitionsFileItem);
CompileEnvironment.PrecompiledHeaderAction = PrecompiledHeaderAction.Include;
CompileEnvironment.PrecompiledHeaderIncludeFilename = Instance.HeaderFile.Location;
@@ -1039,7 +1051,7 @@ namespace UnrealBuildTool
using (StringWriter Writer = new StringWriter())
{
WriteDefinitions(CompileEnvironment.Definitions, Writer);
- CompileEnvironment.Definitions.Clear();
+ //CompileEnvironment.Definitions.Clear(); @todo: Do not clear definitions prior to end of their usefulness
FileItem PrivateDefinitionsFileItem = Graph.CreateIntermediateTextFile(PrivateDefinitionsFile, Writer.ToString());
CompileEnvironment.ForceIncludeFiles.Add(PrivateDefinitionsFileItem);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment