71 references to MemorySafetyRulesVersion
Microsoft.CodeAnalysis (7)
MemorySafetyRulesVersion.cs (3)
26public static bool IsValid(this MemorySafetyRulesVersion version) 28return version is MemorySafetyRulesVersion.Version1 or MemorySafetyRulesVersion.Version2;
Symbols\IModuleSymbol.cs (2)
48/// A metadata module compiled with an unsupported rules version may return a value that is not defined by <see cref="Microsoft.CodeAnalysis.MemorySafetyRulesVersion"/>. 51MemorySafetyRulesVersion MemorySafetyRulesVersion { get; }
Symbols\ISymbol.cs (2)
164/// Under <see cref="MemorySafetyRulesVersion.Version1"/>, symbols with pointers in their signature are considered requires-unsafe. 165/// Under <see cref="MemorySafetyRulesVersion.Version2"/>, symbols marked <see langword="unsafe"/> are considered requires-unsafe.
Microsoft.CodeAnalysis.CSharp (62)
Binder\Binder_Conversions.cs (2)
3103ReportUnsafeIfNotAllowed(syntax.Location, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version1); 3738&& ReportUnsafeIfNotAllowed(syntax, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version1))
Binder\Binder_Expressions.cs (7)
605ReportUnsafeIfNotAllowed(node, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version1); 1475bool hasErrors = constantValue is null && ReportUnsafeIfNotAllowed(node, diagnostics, sizeOfTypeOpt: type, disallowedUnder: MemorySafetyRulesVersion.Version1); 3731ReportUnsafeIfNotAllowed(argument.Syntax, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version1); 5121hasErrors = ReportUnsafeIfNotAllowed(errorLocation, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version1); 6979hasError = ReportUnsafeIfNotAllowed(node, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version1) || hasError; 7681ReportUnsafeIfNotAllowed(node.OperatorToken.GetLocation(), diagnostics, MemorySafetyRulesVersion.Version2); 10300ReportUnsafeIfNotAllowed(node.ArgumentList.OpenBracketToken.GetLocation(), diagnostics, MemorySafetyRulesVersion.Version2);
Binder\Binder_Invocation.cs (3)
1352gotError = ReportUnsafeIfNotAllowed(node, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version1) || gotError; 2617bool hasErrors = ReportUnsafeIfNotAllowed(node, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version1) || 2618ReportUnsafeIfNotAllowed(node, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version2);
Binder\Binder_Operators.cs (1)
4091ReportUnsafeIfNotAllowed(node.OperatorToken.GetLocation(), diagnostics, MemorySafetyRulesVersion.Version2);
Binder\Binder_Statements.cs (1)
191fixedBinder.ReportUnsafeIfNotAllowed(node, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version1);
Binder\Binder_Symbols.cs (3)
463if (GetUnsafeDiagnosticInfo(disallowedUnder: MemorySafetyRulesVersion.Version1, sizeOfTypeOpt: null) is CSDiagnosticInfo info) 606ReportUnsafeIfNotAllowed(node, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version1); 932ReportUnsafeIfNotAllowed(node, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version1);
Binder\Binder_Unsafe.cs (13)
118ReportUnsafeIfNotAllowed(arg, location, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version2, 175ReportUnsafeIfNotAllowed(node, diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version2, customErrorCode: ErrorCode.ERR_UnsafeUninitializedStackAlloc); 182MemorySafetyRulesVersion disallowedUnder, 194MemorySafetyRulesVersion disallowedUnder, 213MemorySafetyRulesVersion disallowedUnder, 224MemorySafetyRulesVersion disallowedUnder, 246MemorySafetyRulesVersion disallowedUnder, 262MemorySafetyRulesVersion disallowedUnder, 267Debug.Assert(sizeOfTypeOpt is null || disallowedUnder is MemorySafetyRulesVersion.Version1); 277if (disallowedUnder is MemorySafetyRulesVersion.Version1) 299Debug.Assert(disallowedUnder is MemorySafetyRulesVersion.Version2); 320if (disallowedUnder is MemorySafetyRulesVersion.Version1) 328Debug.Assert(disallowedUnder is MemorySafetyRulesVersion.Version2);
BoundTree\UnboundLambda.cs (1)
977this.Binder.ReportUnsafeIfNotAllowed(this.ParameterLocation(i), diagnostics, disallowedUnder: MemorySafetyRulesVersion.Version1);
CSharpCompilationOptions.cs (12)
44public MemorySafetyRulesVersion MemorySafetyRulesVersion { get; private set; } 162memorySafetyRulesVersion: MemorySafetyRulesVersion.Version1) 287MemorySafetyRulesVersion memorySafetyRulesVersion) 496public CSharpCompilationOptions WithMemorySafetyRulesVersion(MemorySafetyRulesVersion version) 507=> WithMemorySafetyRulesVersion(enabled ? MemorySafetyRulesVersion.Version2 : MemorySafetyRulesVersion.Version1); 509internal bool UseUpdatedMemorySafetyRules => MemorySafetyRulesVersion == MemorySafetyRulesVersion.Version2; 813if (MemorySafetyRulesVersion is not (MemorySafetyRulesVersion.Version1 or MemorySafetyRulesVersion.Version2)) 815builder.Add(Diagnostic.Create(MessageProvider.Instance, (int)ErrorCode.ERR_BadCompilationOptionValueAccepted, nameof(MemorySafetyRulesVersion), MemorySafetyRulesVersion, string.Join(", ", [(int)MemorySafetyRulesVersion.Version1, (int)MemorySafetyRulesVersion.Version2]))); 1035memorySafetyRulesVersion: MemorySafetyRulesVersion.Version1)
SymbolDisplay\SymbolDisplayVisitor.Members.cs (1)
968symbol.ContainingModule.MemorySafetyRulesVersion == MemorySafetyRulesVersion.Version2)
Symbols\Metadata\PE\PEModuleSymbol.cs (6)
119private SingleInitNullable<MemorySafetyRulesVersion> _lazyMemorySafetyRulesVersion; 752internal override MemorySafetyRulesVersion MemorySafetyRulesVersion 764version != (int)MemorySafetyRulesVersion.Version1) 766return (MemorySafetyRulesVersion)version; 770? (MemorySafetyRulesVersion)(-1) 771: MemorySafetyRulesVersion.Version1;
Symbols\Metadata\PE\PEUtilities.cs (1)
29((int)MemorySafetyRulesVersion.Version2).ToString(CultureInfo.InvariantCulture));
Symbols\MissingModuleSymbol.cs (2)
203internal sealed override MemorySafetyRulesVersion MemorySafetyRulesVersion => MemorySafetyRulesVersion.Version1;
Symbols\ModuleSymbol.cs (2)
324internal abstract MemorySafetyRulesVersion MemorySafetyRulesVersion { get; } 326internal bool UseUpdatedMemorySafetyRules => MemorySafetyRulesVersion == MemorySafetyRulesVersion.Version2;
Symbols\PublicModel\ModuleSymbol.cs (1)
47MemorySafetyRulesVersion IModuleSymbol.MemorySafetyRulesVersion => _underlying.MemorySafetyRulesVersion;
Symbols\Retargeting\RetargetingModuleSymbol.cs (1)
322internal override MemorySafetyRulesVersion MemorySafetyRulesVersion => _underlyingModule.MemorySafetyRulesVersion;
Symbols\Source\SourceMemberFieldSymbol.cs (1)
626binder.ReportUnsafeIfNotAllowed(declarator.Location, diagnosticsForFirstDeclarator, disallowedUnder: MemorySafetyRulesVersion.Version1);
Symbols\Source\SourceModuleSymbol.cs (4)
684if (MemorySafetyRulesVersion != MemorySafetyRulesVersion.Version1) 750internal override MemorySafetyRulesVersion MemorySafetyRulesVersion 757? MemorySafetyRulesVersion.Version2 758: MemorySafetyRulesVersion.Version1;
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
Serialization\CSharpOptionsSerializationService.cs (2)
58var memorySafetyRulesVersion = (MemorySafetyRulesVersion)reader.ReadByte();