Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor CommonCompiler.RunCore #23059

Merged
merged 5 commits into from
Nov 13, 2017

Conversation

agocke
Copy link
Member

@agocke agocke commented Nov 7, 2017

This is the monolith method for batch compilation in C# and VB.
It is large and confusing. I've tried to make it better by moving to a single
error reporting system for every piece of the pipeline (Diagnostics in DiagnosticBags).

It may be helpful to look at each commit separately.

RunCore previously had a mix of diagnostic reporting methods including
lists of Diagnostics, lists of DiagnosticInfos, ConcurrentQueues of
Diagnostics, and just printing things directly to the console. This
commit tries to simplify things by moving to using Diagnostics and
DiagnosticBags wherever possible in the compile+emit phase of RunCore.
@agocke agocke requested review from jaredpar and a team November 7, 2017 23:20
@agocke
Copy link
Member Author

agocke commented Nov 10, 2017

ping @dotnet/roslyn-compiler for review

Copy link
Contributor

@khyperia khyperia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ this looks super good!

@@ -429,6 +429,10 @@ public bool ReportErrors(IEnumerable<Diagnostic> diagnostics, TextWriter console
return hasErrors;
}

private bool ReportErrors(DiagnosticBag diagnostics, TextWriter consoleOutput, ErrorLogger errorLoggerOpt)
=> ReportErrors(diagnostics.ToReadOnly(), consoleOutput, errorLoggerOpt);
Copy link
Member

@jcouv jcouv Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: two empty lines #Closed

@@ -385,7 +385,7 @@ internal static DiagnosticInfo ToFileReadDiagnostics(CommonMessageProvider messa
return diagnosticInfo;
}

public bool ReportErrors(IEnumerable<Diagnostic> diagnostics, TextWriter consoleOutput, ErrorLogger errorLoggerOpt)
internal bool ReportErrors(IEnumerable<Diagnostic> diagnostics, TextWriter consoleOutput, ErrorLogger errorLoggerOpt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could IEnumerable be switched to ImmutableArray, or are there callers that still need IEnumerable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They still use IEnumerable unfortunately.

analyzerCts = null;
reportAnalyzer = false;
analyzerDriver = null;
AnalyzerManager analyzerManager = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think analyzerManager can be declared at line 660, where it is used.

WithOutputNameOverride(outputName).
WithPdbFilePath(PathUtilities.NormalizePathPrefix(finalPdbFilePath, Arguments.PathMap));

// This feature flag is being maintained until our next major release to avoid unnecessary
Copy link
Member

@jcouv jcouv Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next major releas [](start = 67, length = 17)

This is not introduced by this PR, but which release is the "next major release". Was it 15.0? Is it 16.0?
Could you file a follow-up issue? #Closed

Copy link
Member Author

@agocke agocke Nov 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that is this issue: #19592 #Resolved

{
return GetWin32ResourcesInternal(MessageProvider, arguments, compilation, out errors);
return GetWin32ResourcesInternal(MessageProvider, arguments, compilation, diagnostics);
}

// internal for testing
internal static Stream GetWin32ResourcesInternal(CommonMessageProvider messageProvider, CommandLineArguments arguments, Compilation compilation, out IEnumerable<DiagnosticInfo> errors)
Copy link
Member

@jcouv jcouv Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think we could change IEnumerable to ImmutableArray in GetWin32ResourcesInternal and GetWin32Resources signatures too

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with review pass (small suggestions to consider)

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks

@agocke agocke closed this Nov 13, 2017
@agocke agocke reopened this Nov 13, 2017
@agocke agocke merged commit 7dea5aa into dotnet:post-dev15.5-contrib Nov 13, 2017
@agocke agocke deleted the refactor-runcore branch November 13, 2017 19:51
@jcouv jcouv added this to the 15.6 milestone Jan 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants