Skip to content

Commit

Permalink
Merge pull request #4648 from dotnet/merges/2.9.x-to-master
Browse files Browse the repository at this point in the history
Merge 2.9.x to master
  • Loading branch information
mavasani committed Jan 4, 2021
2 parents 2c2099e + defe592 commit b8d5ea3
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,8 @@ private static bool IsDisposeBoolCall(IInvocationOperation invocationExpression,
/// </summary>
private sealed class DisposeImplementationValidator
{
// this type will be created per compilation
// this is actually a bug - https://github.com/dotnet/roslyn-analyzers/issues/845
#pragma warning disable RS1008
private readonly IMethodSymbol _suppressFinalizeMethod;
private readonly INamedTypeSymbol _type;
#pragma warning restore RS1008
private bool _callsDisposeBool;
private bool _callsSuppressFinalize;

Expand Down Expand Up @@ -625,11 +621,7 @@ private bool IsSuppressFinalizeCall(IInvocationOperation invocationExpression)
/// </summary>
private sealed class FinalizeImplementationValidator
{
// Avoid storing per-compilation data into the fields of a diagnostic analyzer.
// this is actually a bug - https://github.com/dotnet/roslyn-analyzers/issues/845
#pragma warning disable RS1008
private readonly INamedTypeSymbol _type;
#pragma warning restore RS1008
private bool _callDispose;

public FinalizeImplementationValidator(INamedTypeSymbol type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ internal class ObjectGraphOptions
/// <summary>
/// Serialization with Newtonsoft Json.NET.
/// </summary>
[SuppressMessage("Documentation", "CA1200:Avoid using cref tags with a prefix", Justification = "Type not referenced by assembly.")]
public bool NewtonsoftJsonNetSerialization { get; private set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
using Microsoft.CodeAnalysis.Testing.Verifiers;
using Microsoft.CodeAnalysis.VisualBasic.Testing;

#pragma warning disable CA1000 // Do not declare static members on generic types

namespace Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers.UnitTests
{
public static partial class VisualBasicPerformanceCodeFixVerifier<TAnalyzer, TCodeFix>
Expand Down
11 changes: 5 additions & 6 deletions src/Utilities/Compiler/PooledObjects/ArrayBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Diagnostics;
using System.Threading;

#pragma warning disable CA1710 // Rename Microsoft.CodeAnalysis.ArrayBuilder<T> to end in 'Collection'.
#pragma warning disable CA1000 // Do not declare static members on generic types

namespace Analyzer.Utilities.PooledObjects
Expand Down Expand Up @@ -99,7 +98,7 @@ public int Count
}

/// <summary>
/// Write <paramref name="value"/> to slot <paramref name="index"/>.
/// Write <paramref name="value"/> to slot <paramref name="index"/>.
/// Fills in unallocated slots preceding the <paramref name="index"/>, if any.
/// </summary>
public void SetItem(int index, T value)
Expand Down Expand Up @@ -306,7 +305,7 @@ public T[] ToArrayAndFree()
#region Poolable

// To implement Poolable, you need two things:
// 1) Expose Freeing primitive.
// 1) Expose Freeing primitive.
private void Free()
{
var pool = _pool;
Expand All @@ -317,9 +316,9 @@ private void Free()
// After about 50 (just 67) we have a long tail of infrequently used builder sizes.
// However we have builders with size up to 50K (just one such thing)
//
// We do not want to retain (potentially indefinitely) very large builders
// We do not want to retain (potentially indefinitely) very large builders
// while the chance that we will need their size is diminishingly small.
// It makes sense to constrain the size to some "not too small" number.
// It makes sense to constrain the size to some "not too small" number.
// Overall perf does not seem to be very sensitive to this number, so I picked 128 as a limit.
if (_builder.Capacity < 128)
{
Expand Down Expand Up @@ -414,7 +413,7 @@ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
}

// bucketize
// prevent reallocation. it may not have 'count' entries, but it won't have more.
// prevent reallocation. it may not have 'count' entries, but it won't have more.
var accumulator = new Dictionary<K, ArrayBuilder<T>>(Count, comparer);
for (int i = 0; i < Count; i++)
{
Expand Down
2 changes: 0 additions & 2 deletions src/Utilities/Compiler/PooledObjects/PooledHashSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
using System.Diagnostics;
using System.Threading;

#pragma warning disable CA1710 // Rename Microsoft.CodeAnalysis.PooledHashSet<T> to end in 'Collection'.
#pragma warning disable CA1000 // Do not declare static members on generic types
#pragma warning disable CA2237 // Add [Serializable] to PooledHashSet as this type implements ISerializable

namespace Analyzer.Utilities.PooledObjects
{
Expand Down

0 comments on commit b8d5ea3

Please sign in to comment.