From 9c9016c4498dd9974a5b3c7ca69ab4dc5e392518 Mon Sep 17 00:00:00 2001 From: Michael Voorhees Date: Tue, 18 Jul 2023 10:07:01 -0400 Subject: [PATCH] Add Driver.Context setter We implement our own `Driver.SetupContext`. Our command line parsing logic is different and we have additional command line options. In our very old revision of the upstream linker there was ``` protected LinkContext context; ``` Which we would set. This would ensure that if one of the helper methods that uses the context were called that things would all work. The most common scenario seems to be for error logging. There are many helper methods that will call `Context.LogError` and if we haven't set the `context` field by then we have a problem. We are syncing up and now the `context` field is private and there is a protected property getter, but no setter. Adding a setter was the easiest way to get our context stored in the `context` field. --- src/tools/illink/src/linker/Linker/Driver.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools/illink/src/linker/Linker/Driver.cs b/src/tools/illink/src/linker/Linker/Driver.cs index 5d646965a18a76..9dfff98f77f431 100644 --- a/src/tools/illink/src/linker/Linker/Driver.cs +++ b/src/tools/illink/src/linker/Linker/Driver.cs @@ -83,6 +83,10 @@ protected LinkContext Context { Debug.Assert (context != null); return context; } + set { + Debug.Assert (context == null); + context = value; + } } private static readonly char[] s_separators = new char[] { ',', ';', ' ' };