aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core')
-rw-r--r--src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs12
-rw-r--r--src/WixToolset.Core/Link/IntermediateSymbolExtensions.cs6
-rw-r--r--src/WixToolset.Core/Link/ResolveReferencesCommand.cs4
-rw-r--r--src/WixToolset.Core/Linker.cs5
4 files changed, 20 insertions, 7 deletions
diff --git a/src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs b/src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs
index 1c2ca8eb..a4b2bee3 100644
--- a/src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs
+++ b/src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs
@@ -38,10 +38,17 @@ namespace WixToolset.Core.Link
38 /// </summary> 38 /// </summary>
39 public IEnumerable<SymbolWithSection> PossibleConflicts { get; private set; } 39 public IEnumerable<SymbolWithSection> PossibleConflicts { get; private set; }
40 40
41 /// <summary>
42 /// Gets the collection of redundant symbols that should not be included
43 /// in the final output.
44 /// </summary>
45 public ISet<IntermediateSymbol> RedundantSymbols { get; private set; }
46
41 public void Execute() 47 public void Execute()
42 { 48 {
43 var symbolsByName = new Dictionary<string, SymbolWithSection>(); 49 var symbolsByName = new Dictionary<string, SymbolWithSection>();
44 var possibleConflicts = new HashSet<SymbolWithSection>(); 50 var possibleConflicts = new HashSet<SymbolWithSection>();
51 var redundantSymbols = new HashSet<IntermediateSymbol>();
45 52
46 if (!Enum.TryParse(this.ExpectedOutputType.ToString(), out SectionType expectedEntrySectionType)) 53 if (!Enum.TryParse(this.ExpectedOutputType.ToString(), out SectionType expectedEntrySectionType))
47 { 54 {
@@ -91,13 +98,13 @@ namespace WixToolset.Core.Link
91 // Ensure identical symbol's symbol is marked redundant to ensure (should the symbol be 98 // Ensure identical symbol's symbol is marked redundant to ensure (should the symbol be
92 // referenced into the final output) it will not add duplicate primary keys during 99 // referenced into the final output) it will not add duplicate primary keys during
93 // the .IDT importing. 100 // the .IDT importing.
94 //symbol.Row.Redundant = true; - TODO: remove this
95 existingSymbol.AddRedundant(symbolWithSection); 101 existingSymbol.AddRedundant(symbolWithSection);
102 redundantSymbols.Add(symbolWithSection.Symbol);
96 } 103 }
97 else 104 else
98 { 105 {
99 existingSymbol.AddPossibleConflict(symbolWithSection); 106 existingSymbol.AddPossibleConflict(symbolWithSection);
100 possibleConflicts.Add(existingSymbol); 107 possibleConflicts.Add(symbolWithSection);
101 } 108 }
102 } 109 }
103 } 110 }
@@ -105,6 +112,7 @@ namespace WixToolset.Core.Link
105 112
106 this.SymbolsByName = symbolsByName; 113 this.SymbolsByName = symbolsByName;
107 this.PossibleConflicts = possibleConflicts; 114 this.PossibleConflicts = possibleConflicts;
115 this.RedundantSymbols = redundantSymbols;
108 } 116 }
109 } 117 }
110} 118}
diff --git a/src/WixToolset.Core/Link/IntermediateSymbolExtensions.cs b/src/WixToolset.Core/Link/IntermediateSymbolExtensions.cs
index db53f1ce..cbf48abe 100644
--- a/src/WixToolset.Core/Link/IntermediateSymbolExtensions.cs
+++ b/src/WixToolset.Core/Link/IntermediateSymbolExtensions.cs
@@ -1,4 +1,4 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. 1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 2
3namespace WixToolset.Core.Link 3namespace WixToolset.Core.Link
4{ 4{
@@ -9,10 +9,10 @@ namespace WixToolset.Core.Link
9 public static bool IsIdentical(this IntermediateSymbol first, IntermediateSymbol second) 9 public static bool IsIdentical(this IntermediateSymbol first, IntermediateSymbol second)
10 { 10 {
11 var identical = (first.Definition.Type == second.Definition.Type && 11 var identical = (first.Definition.Type == second.Definition.Type &&
12 first.Definition.Name == second.Definition.Name && 12 (first.Definition.Type != SymbolDefinitionType.MustBeFromAnExtension || first.Definition.Name == second.Definition.Name) &&
13 first.Definition.FieldDefinitions.Length == second.Definition.FieldDefinitions.Length); 13 first.Definition.FieldDefinitions.Length == second.Definition.FieldDefinitions.Length);
14 14
15 for (int i = 0; identical && i < first.Definition.FieldDefinitions.Length; ++i) 15 for (var i = 0; identical && i < first.Definition.FieldDefinitions.Length; ++i)
16 { 16 {
17 var firstField = first[i]; 17 var firstField = first[i];
18 var secondField = second[i]; 18 var secondField = second[i];
diff --git a/src/WixToolset.Core/Link/ResolveReferencesCommand.cs b/src/WixToolset.Core/Link/ResolveReferencesCommand.cs
index 90b61e8b..2bdd5646 100644
--- a/src/WixToolset.Core/Link/ResolveReferencesCommand.cs
+++ b/src/WixToolset.Core/Link/ResolveReferencesCommand.cs
@@ -170,9 +170,9 @@ namespace WixToolset.Core.Link
170 case AccessModifier.Public: 170 case AccessModifier.Public:
171 return true; 171 return true;
172 case AccessModifier.Internal: 172 case AccessModifier.Internal:
173 return symbolWithSection.Section.CompilationId.Equals(referencingSection.CompilationId) || (null != symbolWithSection.Section.LibraryId && symbolWithSection.Section.LibraryId.Equals(referencingSection.LibraryId)); 173 return symbolWithSection.Section.CompilationId == referencingSection.CompilationId || (null != symbolWithSection.Section.LibraryId && symbolWithSection.Section.LibraryId == referencingSection.LibraryId);
174 case AccessModifier.Protected: 174 case AccessModifier.Protected:
175 return symbolWithSection.Section.CompilationId.Equals(referencingSection.CompilationId); 175 return symbolWithSection.Section.CompilationId == referencingSection.CompilationId;
176 case AccessModifier.Private: 176 case AccessModifier.Private:
177 return referencingSection == symbolWithSection.Section; 177 return referencingSection == symbolWithSection.Section;
178 default: 178 default:
diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs
index e9f9554c..431ba4c7 100644
--- a/src/WixToolset.Core/Linker.cs
+++ b/src/WixToolset.Core/Linker.cs
@@ -226,6 +226,11 @@ namespace WixToolset.Core
226 226
227 foreach (var symbol in section.Symbols) 227 foreach (var symbol in section.Symbols)
228 { 228 {
229 if (find.RedundantSymbols.Contains(symbol))
230 {
231 continue;
232 }
233
229 var copySymbol = true; // by default, copy symbols. 234 var copySymbol = true; // by default, copy symbols.
230 235
231 // handle special tables 236 // handle special tables