71 references to ValueUsageInfo
Microsoft.CodeAnalysis.CodeStyle (71)
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
246var valueUsageInfo = fieldReference.GetValueUsageInfo(owningSymbol);
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (21)
89protected virtual void HandleNamedTypeSymbolStart(SymbolStartAnalysisContext context, Action<ISymbol, ValueUsageInfo> onSymbolUsageFound) 100private readonly Dictionary<ISymbol, ValueUsageInfo> _symbolValueUsageStateMap = []; 206Action<ISymbol, ValueUsageInfo> onSymbolUsageFound = OnSymbolUsage; 289_symbolValueUsageStateMap.TryAdd(symbol, ValueUsageInfo.None); 299OnSymbolUsage(method, ValueUsageInfo.Read); 315OnSymbolUsage(field, ValueUsageInfo.Write); 320private void OnSymbolUsage(ISymbol? memberSymbol, ValueUsageInfo usageInfo) 330if (_symbolValueUsageStateMap.TryGetValue(memberSymbol, out var currentUsageInfo)) 339private bool TryRemove(ISymbol memberSymbol, out ValueUsageInfo valueUsageInfo) 360var valueUsageInfo = memberReference.GetValueUsageInfo(operationContext.ContainingSymbol); 362if (valueUsageInfo == ValueUsageInfo.ReadWrite) 391valueUsageInfo = ValueUsageInfo.Write; 417OnSymbolUsage(symbols.CurrentProperty, ValueUsageInfo.Read); 418OnSymbolUsage(symbols.GetEnumeratorMethod, ValueUsageInfo.Read); 419OnSymbolUsage(symbols.MoveNextMethod, ValueUsageInfo.Read); 428OnSymbolUsage(targetMethod, ValueUsageInfo.Read); 433OnSymbolUsage(targetMethod.ReducedFrom, ValueUsageInfo.Read); 447OnSymbolUsage(memberReference.Member.OriginalDefinition, ValueUsageInfo.ReadWrite); 456OnSymbolUsage(symbol.OriginalDefinition, ValueUsageInfo.ReadWrite); 465OnSymbolUsage(constructor, ValueUsageInfo.Read); 502if (TryRemove(member, out var valueUsageInfo) && !valueUsageInfo.IsReadFrom())
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (31)
24/// Returns the <see cref="ValueUsageInfo"/> for the given operation. 27public static ValueUsageInfo GetValueUsageInfo(this IOperation operation, ISymbol containingSymbol) 56return ValueUsageInfo.Write; 77return ValueUsageInfo.Write; 88return ValueUsageInfo.Write; 98return ValueUsageInfo.Write; 106return ValueUsageInfo.Write; 114return ValueUsageInfo.Write; 120return ValueUsageInfo.ReadWrite; 125return ValueUsageInfo.Write; 132? ValueUsageInfo.ReadWrite 133: ValueUsageInfo.Write; 139return ValueUsageInfo.ReadableWritableReference; 143return ValueUsageInfo.ReadWrite; 151~(ValueUsageInfo.Write | ValueUsageInfo.Reference); 157return ValueUsageInfo.Name; 164return ValueUsageInfo.ReadableReference; 167return ValueUsageInfo.WritableReference; 170return ValueUsageInfo.ReadableWritableReference; 173return ValueUsageInfo.Read; 180RefKind.RefReadOnly => ValueUsageInfo.ReadableReference, 181RefKind.Ref => ValueUsageInfo.ReadableWritableReference, 182_ => ValueUsageInfo.Read, 194return ValueUsageInfo.Read; 201? ValueUsageInfo.ReadWrite 202: ValueUsageInfo.Write; 210return ValueUsageInfo.Write; 219return ValueUsageInfo.ReadableWritableReference; 222return ValueUsageInfo.ReadableReference; 227return ValueUsageInfo.Read;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (5)
15/// For methods, fields, properties, events, locals and parameters, this corresponds to values from <see cref="ValueUsageInfo"/>. 20public static readonly SymbolUsageInfo None = Create(ValueUsageInfo.None); 23public ValueUsageInfo? ValueUsageInfoOpt { get; } 29public SymbolUsageInfo(ValueUsageInfo? valueUsageInfoOpt, TypeOrNamespaceUsageInfo? typeOrNamespaceUsageInfoOpt) 37public static SymbolUsageInfo Create(ValueUsageInfo valueUsageInfo)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ValueUsageInfo.cs (8)
69public static bool IsReadFrom(this ValueUsageInfo valueUsageInfo) 70=> (valueUsageInfo & ValueUsageInfo.Read) != 0; 72public static bool IsWrittenTo(this ValueUsageInfo valueUsageInfo) 73=> (valueUsageInfo & ValueUsageInfo.Write) != 0; 75public static bool IsNameOnly(this ValueUsageInfo valueUsageInfo) 76=> (valueUsageInfo & ValueUsageInfo.Name) != 0; 78public static bool IsReference(this ValueUsageInfo valueUsageInfo) 79=> (valueUsageInfo & ValueUsageInfo.Reference) != 0;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (5)
94private void OnWriteReferenceFound(ISymbol symbol, IOperation operation, ValueUsageInfo valueUsageInfo) 97var isRef = valueUsageInfo == ValueUsageInfo.ReadableWritableReference; 112var valueUsageInfo = operation.GetValueUsageInfo(_currentContainingSymbol); 199OnWriteReferenceFound(symbolOpt, write, ValueUsageInfo.Write); 275OnWriteReferenceFound(operation.Symbol, operation, ValueUsageInfo.Write);