Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
721db06
Extract class to its own file
CyrusNajmabadi Aug 21, 2025
687783a
Extract remote-host dispatching code to its own file
CyrusNajmabadi Aug 21, 2025
1d38cc0
Remove unnecessary 'diag incremental analyzer' indirection
CyrusNajmabadi Aug 21, 2025
da0c2db
Make fields private
CyrusNajmabadi Aug 21, 2025
84e49a4
Merge related code and rename file
CyrusNajmabadi Aug 21, 2025
0478e3e
Merge related code and rename file
CyrusNajmabadi Aug 21, 2025
ea82ef5
Merge function and helper
CyrusNajmabadi Aug 21, 2025
0c07bd3
Rename file
CyrusNajmabadi Aug 21, 2025
2b643cc
Rename files
CyrusNajmabadi Aug 21, 2025
00592e3
Name methods to make it clear where they run
CyrusNajmabadi Aug 21, 2025
bcdad14
Update tests
CyrusNajmabadi Aug 21, 2025
67b117a
Expose through test accessor
CyrusNajmabadi Aug 21, 2025
4a0c3d5
Inline methods
CyrusNajmabadi Aug 21, 2025
53ba623
Extract type into its own file and rename file
CyrusNajmabadi Aug 21, 2025
644a8a0
Rename file
CyrusNajmabadi Aug 21, 2025
575fc07
Move files up one directory
CyrusNajmabadi Aug 21, 2025
ca1b7c4
Use immutable arrays
CyrusNajmabadi Aug 21, 2025
a37c8d6
Remove 'state manager' indirection
CyrusNajmabadi Aug 21, 2025
2052db0
inline method
CyrusNajmabadi Aug 21, 2025
3004968
Simply arguments
CyrusNajmabadi Aug 21, 2025
693a77a
Disposable buildrs
CyrusNajmabadi Aug 21, 2025
4ed8d81
Switch to a non-async interlocked update for our dictionaries
CyrusNajmabadi Aug 21, 2025
d3b74d7
Merge branch 'main' into diagCleanup
CyrusNajmabadi Aug 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using System.Collections.Immutable;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.Diagnostics;

internal sealed partial class DiagnosticAnalyzerService
{
private sealed class ChecksumAndAnalyzersEqualityComparer
: IEqualityComparer<(Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers)>
{
public static readonly ChecksumAndAnalyzersEqualityComparer Instance = new();

public bool Equals((Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers) x, (Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers) y)
{
if (x.checksum != y.checksum)
return false;

// Fast path for when the analyzers are the same reference.
return x.analyzers == y.analyzers || x.analyzers.SetEquals(y.analyzers);
}

public int GetHashCode((Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers) obj)
{
var hashCode = obj.checksum.GetHashCode();

// Use addition so that we're resilient to any order for the analyzers.
foreach (var analyzer in obj.analyzers)
hashCode += analyzer.GetHashCode();

return hashCode;
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure the name of this file is right.

Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,6 @@ namespace Microsoft.CodeAnalysis.Diagnostics;

internal sealed partial class DiagnosticAnalyzerService
{
private sealed class ChecksumAndAnalyzersEqualityComparer
: IEqualityComparer<(Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers)>
{
public static readonly ChecksumAndAnalyzersEqualityComparer Instance = new();

public bool Equals((Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers) x, (Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers) y)
{
if (x.checksum != y.checksum)
return false;

// Fast path for when the analyzers are the same reference.
return x.analyzers == y.analyzers || x.analyzers.SetEquals(y.analyzers);
}

public int GetHashCode((Checksum checksum, ImmutableArray<DiagnosticAnalyzer> analyzers) obj)
{
var hashCode = obj.checksum.GetHashCode();

// Use addition so that we're resilient to any order for the analyzers.
foreach (var analyzer in obj.analyzers)
hashCode += analyzer.GetHashCode();

return hashCode;
}
}

/// <summary>
/// Cached data from a <see cref="ProjectState"/> to the <see cref="CompilationWithAnalyzersPair"/>s
/// we've created for it. Note: the CompilationWithAnalyzersPair instance is dependent on the set of <see
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Microsoft.CodeAnalysis.PooledObjects;

namespace Microsoft.CodeAnalysis.Diagnostics;

Expand Down