Skip to content

[BatchMode] Avoid spurious warnings in sourcekitd and indexing #16067

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

Merged

Conversation

benlangmuir
Copy link
Contributor

@benlangmuir benlangmuir commented Apr 20, 2018

Explicitly disable batch mode in createCompilerInvocation, since it uses
-force-single-frontend-invocation. Previously we were getting spurious
warnings. Also add a test that -disable-batch-mode will allow commands
that use -index-file to avoid the same warning, since that is likely
what they want to do as well.

rdar://39581506

@benlangmuir
Copy link
Contributor Author

@swift-ci please smoke test

@benlangmuir benlangmuir requested a review from graydon April 20, 2018 18:06
Copy link
Contributor

@graydon graydon left a comment

Choose a reason for hiding this comment

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

Looks good to me but the last person to touch this logic was @davidungar so probably best to ask him.

@benlangmuir benlangmuir requested a review from davidungar April 20, 2018 18:15
Explicitly disable batch mode in createCompilerInvocation, since it uses
-force-single-frontend-invocation.  Previously we were getting spurious
warnings.  Also add a test that -disable-batch-mode will allow commands
that use -index-file to avoid the same warning, since that is likely
what they want to do as well.

rdar://39581506
@benlangmuir benlangmuir force-pushed the batch-mode-spurious-warnings branch from 5d8c977 to 8ea2d0d Compare April 20, 2018 18:29
@benlangmuir
Copy link
Contributor Author

(new commit is to fix the commit message; no change to code)

@benlangmuir
Copy link
Contributor Author

@swift-ci please smoke test

@davidungar
Copy link
Contributor

Where is the -enable-batch-mode coming from? Would it be reasonable to remove that in addition to annihilating it with an anti-particle? Or is that not under our control in this circumstances? I like leaving the disable-batch-mode in for the day when batch mode becomes the default.

@@ -13,6 +13,12 @@
// RUN: %FileCheck -check-prefix CHECK-INDEX %s <%t/stderr_batch_index
// CHECK-INDEX: warning: ignoring '-enable-batch-mode' because '-index-file' was also specified
//
// RUN: %swiftc_driver -disable-batch-mode -index-file %S/../Inputs/empty.swift -### 2>%t/stderr_nobatch_index | %FileCheck %s
Copy link
Contributor

Choose a reason for hiding this comment

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

How about adding a comment like the one on line 22, briefly describing the reason for the test? As a newbie, I've found such to help a lot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll add a follow-up commit explaining what my goal is here. Roughly:

The following test is verifying that -disable-batch-mode overrides an earlier -enable-batch-mode and silences the warning about mixing batch mode with -index-file. Tools that take an existing command line and add -index-file can add -disable-batch-mode without having to otherwise interpret the arguments.

Copy link
Contributor

@davidungar davidungar left a comment

Choose a reason for hiding this comment

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

I've written a few thoughts down for your consideration, but none of them are critical.

@benlangmuir
Copy link
Contributor Author

Where is the -enable-batch-mode coming from?

A build system or end user. Somewhere outside the compiler in any case.

Would it be reasonable to remove that in addition to annihilating it with an anti-particle? Or is that not under our control in this circumstances?

Do you mean remove it inside createCompileInvocation() or ask the end-user/build system to remove it? If you mean the former, then I guess we could although I don't see the advantage. If you mean the latter, then it is outside our control in the compiler and I don't think that external tools should need to care about how -enable-batch-mode interacts with implementation details of sourcekitd or indexing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants