Welcome to mirror list, hosted at ThFree Co, Russian Federation.

DiagnosticContext.cs « Linker.Dataflow « linker « src - github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 51997c92b6b1b991d72e5c4cbba718e8209e58ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Mono.Linker;

namespace ILLink.Shared.TrimAnalysis
{
	public readonly partial struct DiagnosticContext
	{
		public readonly MessageOrigin Origin;
		public readonly bool DiagnosticsEnabled;
		readonly LinkContext _context;

		public DiagnosticContext (in MessageOrigin origin, bool diagnosticsEnabled, LinkContext context)
			=> (Origin, DiagnosticsEnabled, _context) = (origin, diagnosticsEnabled, context);

		public partial void AddDiagnostic (DiagnosticId id, params string[] args)
		{
			if (DiagnosticsEnabled)
				_context.LogWarning (Origin, id, args);
		}

#pragma warning disable IDE0060, CA1822 // The details provided here are not used by illink, but they are used for example by the analyzer
		public partial void AddDiagnostic (DiagnosticId id, ValueWithDynamicallyAccessedMembers actualValue, ValueWithDynamicallyAccessedMembers expectedAnnotationsValue, params string[] args)
		{
			AddDiagnostic (id, args);
		}
#pragma warning restore IDE0060, CA1822
	}
}