protected override void ComputeHashCodePartsSpecific(ArrayBuilder <int> builder)
 {
     builder.Add(TrackInstanceFields.GetHashCode());
     builder.Add(DisposeOwnershipTransferAtConstructor.GetHashCode());
     builder.Add(DisposeOwnershipTransferAtMethodCall.GetHashCode());
     builder.Add(HashUtilities.Combine(DisposeOwnershipTransferLikelyTypes));
 }
예제 #2
0
 public override int GetHashCode()
 {
     return(HashUtilities.Combine(this.SanitizingMethods,
                                  HashUtilities.Combine(this.SanitizingInstanceMethods,
                                                        HashUtilities.Combine(StringComparer.Ordinal.GetHashCode(this.FullTypeName),
                                                                              this.IsConstructorSanitizing.GetHashCode()))));
 }
        protected CacheBasedEquatable()
        {
#pragma warning disable CA2214 // Do not call overridable methods in constructors
                               // https://github.com/dotnet/roslyn-analyzers/issues/1652
            _lazyHashCode = new Lazy <int>(() => HashUtilities.Combine(GetType().GetHashCode(), ComputeHashCode()));
#pragma warning restore CA2214 // Do not call overridable methods in constructors
        }
예제 #4
0
 protected override void ComputeHashCodePartsSpecific(ref RoslynHashCode hashCode)
 {
     hashCode.Add(TrackInstanceFields.GetHashCode());
     hashCode.Add(DisposeOwnershipTransferAtConstructor.GetHashCode());
     hashCode.Add(DisposeOwnershipTransferAtMethodCall.GetHashCode());
     hashCode.Add(HashUtilities.Combine(DisposeOwnershipTransferLikelyTypes));
 }
 protected override void ComputeHashCodeParts(ArrayBuilder <int> builder)
 {
     builder.Add(HashUtilities.Combine(Locations));
     builder.Add(HashUtilities.Combine(LValueCapturedOperations));
     builder.Add(Kind.GetHashCode());
     builder.Add(NullState.GetHashCode());
 }
 protected override void ComputeHashCodeParts(Action <int> addPart)
 {
     addPart(HashUtilities.Combine(EnabledFlights));
     addPart(HashUtilities.Combine(Parents));
     addPart(Height.GetHashCode());
     addPart(Kind.GetHashCode());
 }
 protected override void ComputeHashCodeParts(Action <int> addPart)
 {
     addPart(HashUtilities.Combine(Locations));
     addPart(HashUtilities.Combine(LValueCapturedOperations));
     addPart(Kind.GetHashCode());
     addPart(NullState.GetHashCode());
 }
예제 #8
0
        private AnalysisEntity(
            ISymbol symbolOpt,
            ImmutableArray <AbstractIndex> indices,
            SyntaxNode instanceReferenceOperationSyntaxOpt,
            InterproceduralCaptureId?captureIdOpt,
            PointsToAbstractValue location,
            ITypeSymbol type,
            AnalysisEntity parentOpt,
            bool isThisOrMeInstance)
        {
            Debug.Assert(!indices.IsDefault);
            Debug.Assert(symbolOpt != null || !indices.IsEmpty || instanceReferenceOperationSyntaxOpt != null || captureIdOpt.HasValue);
            Debug.Assert(location != null);
            Debug.Assert(type != null);
            Debug.Assert(parentOpt == null || parentOpt.Type.HasValueCopySemantics() || !indices.IsEmpty);

            SymbolOpt = symbolOpt;
            Indices   = indices;
            InstanceReferenceOperationSyntaxOpt = instanceReferenceOperationSyntaxOpt;
            CaptureIdOpt       = captureIdOpt;
            InstanceLocation   = location;
            Type               = type;
            ParentOpt          = parentOpt;
            IsThisOrMeInstance = isThisOrMeInstance;

            _ignoringLocationHashCodeParts = ComputeIgnoringLocationHashCodeParts();
            _ignoringLocationHashCode      = HashUtilities.Combine(_ignoringLocationHashCodeParts);
        }
예제 #9
0
        private AnalysisEntity(
            ISymbol?symbol,
            ImmutableArray <AbstractIndex> indices,
            SyntaxNode?instanceReferenceOperationSyntax,
            InterproceduralCaptureId?captureId,
            PointsToAbstractValue location,
            ITypeSymbol type,
            AnalysisEntity?parent,
            bool isThisOrMeInstance)
        {
            Debug.Assert(!indices.IsDefault);
            Debug.Assert(symbol != null || !indices.IsEmpty || instanceReferenceOperationSyntax != null || captureId.HasValue);
            Debug.Assert(parent == null || parent.Type.HasValueCopySemantics() || !indices.IsEmpty);

            Symbol  = symbol;
            Indices = indices;
            InstanceReferenceOperationSyntax = instanceReferenceOperationSyntax;
            CaptureId          = captureId;
            InstanceLocation   = location;
            Type               = type;
            Parent             = parent;
            IsThisOrMeInstance = isThisOrMeInstance;

            _ignoringLocationHashCodeParts   = ComputeIgnoringLocationHashCodeParts();
            EqualsIgnoringInstanceLocationId = HashUtilities.Combine(_ignoringLocationHashCodeParts);
        }
 protected override void ComputeHashCodePartsSpecific(Action <int> addPart)
 {
     addPart(TrackInstanceFields.GetHashCode());
     addPart(DisposeOwnershipTransferAtConstructor.GetHashCode());
     addPart(DisposeOwnershipTransferAtMethodCall.GetHashCode());
     addPart(HashUtilities.Combine(DisposeOwnershipTransferLikelyTypes));
 }
예제 #11
0
 public override int GetHashCode()
 {
     return(HashUtilities.Combine(
                this.PropertyName.GetHashCodeOrDefault(),
                HashUtilities.Combine(this.MapFromValueContentAbstractValue.GetHashCodeOrDefault(),
                                      this.MapFromNullAbstractValue.GetHashCodeOrDefault())));
 }
예제 #12
0
 public override int GetHashCode()
 {
     return(HashUtilities.Combine(this.TaintedProperties,
                                  HashUtilities.Combine(this.TaintedMethods,
                                                        HashUtilities.Combine(this.IsInterface.GetHashCode(),
                                                                              StringComparer.Ordinal.GetHashCode(this.FullTypeName)))));
 }
예제 #13
0
        protected override bool ComputeEqualsByHashCodeParts(CacheBasedEquatable <CopyAbstractValue> obj)
        {
            var other = (CopyAbstractValue)obj;

            return(HashUtilities.Combine(AnalysisEntities) == HashUtilities.Combine(other.AnalysisEntities) &&
                   Kind.GetHashCode() == other.Kind.GetHashCode());
        }
예제 #14
0
        public override int GetHashCode()
        {
            var hashCode = new RoslynHashCode();

            HashUtilities.Combine(this.InterfaceInfos, ref hashCode);
            HashUtilities.Combine(this.ConcreteInfos, ref hashCode);
            return(hashCode.ToHashCode());
        }
예제 #15
0
 public override int GetHashCode()
 {
     return(HashUtilities.Combine(
                this._hazardousUsageBuilder.GetHashCode(),
                this._visitedLocalFunctions.GetHashCode(),
                this._visitedLambdas.GetHashCode(),
                base.GetHashCode()));
 }
 protected override int ComputeHashCode()
 {
     return(HashUtilities.Combine(CreationOpt?.GetHashCode() ?? 0,
                                  HashUtilities.Combine(SymbolOpt?.GetHashCode() ?? 0,
                                                        HashUtilities.Combine(AnalysisEntityOpt?.GetHashCode() ?? 0,
                                                                              HashUtilities.Combine(LocationTypeOpt?.GetHashCode() ?? 0,
                                                                                                    HashUtilities.Combine(_isSpecialSingleton.GetHashCode(), IsNull.GetHashCode()))))));
 }
예제 #17
0
 public override int GetHashCode()
 {
     return(HashUtilities.Combine(
                this.ContainingTypeName.GetHashCodeOrDefault(),
                HashUtilities.Combine(this.MethodName.GetHashCodeOrDefault(),
                                      HashUtilities.Combine(this.ParameterNameOfPropertySetObject.GetHashCodeOrDefault(),
                                                            this.InvocationEvaluator.GetHashCodeOrDefault()))));
 }
예제 #18
0
 public override int GetHashCode()
 {
     return(HashUtilities.Combine(this.TaintConstantArray.GetHashCode(),
                                  HashUtilities.Combine(this.TaintedProperties,
                                                        HashUtilities.Combine(this.TaintedMethodsNeedPointsToAnalysis,
                                                                              HashUtilities.Combine(this.TaintedMethodsNeedsValueContentAnalysis,
                                                                                                    HashUtilities.Combine(this.IsInterface.GetHashCode(),
                                                                                                                          StringComparer.Ordinal.GetHashCode(this.FullTypeName)))))));
 }
예제 #19
0
 public override int GetHashCode()
 {
     return(HashUtilities.Combine(this.SinkProperties,
                                  HashUtilities.Combine(this.SinkMethodParameters,
                                                        HashUtilities.Combine(StringComparer.Ordinal.GetHashCode(this.FullTypeName),
                                                                              HashUtilities.Combine(this.SinkKinds,
                                                                                                    HashUtilities.Combine(this.IsInterface.GetHashCode(),
                                                                                                                          this.IsAnyStringParameterInConstructorASink.GetHashCode()))))));
 }
예제 #20
0
        protected override bool ComputeEqualsByHashCodeParts(AbstractDataFlowAnalysisContext <DisposeAnalysisData, DisposeAnalysisContext, DisposeAnalysisResult, DisposeAbstractValue> obj)
        {
            var other = (DisposeAnalysisContext)obj;

            return(TrackInstanceFields.GetHashCode() == other.TrackInstanceFields.GetHashCode() &&
                   DisposeOwnershipTransferAtConstructor.GetHashCode() == other.DisposeOwnershipTransferAtConstructor.GetHashCode() &&
                   DisposeOwnershipTransferAtMethodCall.GetHashCode() == other.DisposeOwnershipTransferAtMethodCall.GetHashCode() &&
                   HashUtilities.Combine(DisposeOwnershipTransferLikelyTypes) == HashUtilities.Combine(other.DisposeOwnershipTransferLikelyTypes));
        }
예제 #21
0
        public override int GetHashCode()
        {
            var hashCode = new RoslynHashCode();

            HashUtilities.Combine(PropertyAbstractValues, ref hashCode);
            hashCode.Add(MapFromValueContentAbstractValue.GetHashCodeOrDefault());
            hashCode.Add(MapFromPointsToAbstractValue.GetHashCodeOrDefault());
            return(hashCode.ToHashCode());
        }
예제 #22
0
 private void ComputeHashCodePartsIgnoringLocation(ArrayBuilder <int> builder)
 {
     builder.Add(SymbolOpt.GetHashCodeOrDefault());
     builder.Add(HashUtilities.Combine(Indices));
     builder.Add(InstanceReferenceOperationSyntaxOpt.GetHashCodeOrDefault());
     builder.Add(CaptureIdOpt.GetHashCodeOrDefault());
     builder.Add(Type.GetHashCode());
     builder.Add(ParentOpt.GetHashCodeOrDefault());
     builder.Add(IsThisOrMeInstance.GetHashCode());
 }
예제 #23
0
 protected override void ComputeHashCodeParts(ArrayBuilder <int> builder)
 {
     builder.Add(CreationOpt.GetHashCodeOrDefault());
     builder.Add(HashUtilities.Combine(CreationCallStack));
     builder.Add(SymbolOpt.GetHashCodeOrDefault());
     builder.Add(AnalysisEntityOpt.GetHashCodeOrDefault());
     builder.Add(LocationTypeOpt.GetHashCodeOrDefault());
     builder.Add(_isSpecialSingleton.GetHashCode());
     builder.Add(IsNull.GetHashCode());
 }
 private void ComputeHashCodePartsIgnoringLocation(Action <int> addPart)
 {
     addPart(SymbolOpt.GetHashCodeOrDefault());
     addPart(HashUtilities.Combine(Indices));
     addPart(InstanceReferenceOperationSyntaxOpt.GetHashCodeOrDefault());
     addPart(CaptureIdOpt.GetHashCodeOrDefault());
     addPart(Type.GetHashCode());
     addPart(ParentOpt.GetHashCodeOrDefault());
     addPart(IsThisOrMeInstance.GetHashCode());
 }
        protected override int ComputeHashCode()
        {
            int hashCode = HashUtilities.Combine(Kind.GetHashCode(), DisposingOrEscapingOperations.Count.GetHashCode());

            foreach (var operation in DisposingOrEscapingOperations)
            {
                hashCode = HashUtilities.Combine(operation.GetHashCode(), hashCode);
            }

            return(hashCode);
        }
예제 #26
0
        public override int GetHashCode()
        {
            var hashCode = new RoslynHashCode();

            HashUtilities.Combine(this.ConcreteInfos, ref hashCode);
            HashUtilities.Combine(this.InterfaceInfos, ref hashCode);
            hashCode.Add(this.RequiresValueContentAnalysis.GetHashCode());
            hashCode.Add(this.RequiresParameterReferenceAnalysis.GetHashCode());
            hashCode.Add(this.RequiresFieldReferenceAnalysis.GetHashCode());
            return(hashCode.ToHashCode());
        }
예제 #27
0
        public override int GetHashCode()
        {
            int hashCode = HashUtilities.Combine(Kind.GetHashCode(), DisposingOperations.Count.GetHashCode());

            foreach (var operation in DisposingOperations)
            {
                hashCode = HashUtilities.Combine(operation.GetHashCode(), hashCode);
            }

            return(hashCode);
        }
        public override int GetHashCode()
        {
            var hashCode = NonLiteralState.GetHashCode();

            foreach (var literal in LiteralValues.OrderBy(s => s))
            {
                hashCode = HashUtilities.Combine(hashCode, literal.GetHashCode());
            }

            return(hashCode);
        }
예제 #29
0
        public override int GetHashCode()
        {
            int hashCode = HashUtilities.Combine(Kind.GetHashCode(), Locations.Count.GetHashCode());

            foreach (var location in Locations)
            {
                hashCode = HashUtilities.Combine(location.GetHashCode(), hashCode);
            }

            return(hashCode);
        }
예제 #30
0
 protected override void ComputeHashCodeParts(Action <int> addPart)
 {
     addPart(CreationOpt.GetHashCodeOrDefault());
     addPart(HashUtilities.Combine(CreationCallStack));
     addPart(SymbolOpt.GetHashCodeOrDefault());
     addPart(CaptureIdOpt.GetHashCodeOrDefault());
     addPart(AnalysisEntityOpt.GetHashCodeOrDefault());
     addPart(LocationTypeOpt.GetHashCodeOrDefault());
     addPart(_isSpecialSingleton.GetHashCode());
     addPart(IsNull.GetHashCode());
 }