-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
[Dependency Scanning] Specify Source Locations For Missing Module Dependencies #73600
Conversation
4a7e534
to
01d7b66
Compare
44d745d
to
2a7f2ff
Compare
@swift-ci test |
// CHECK-NEXT: 2 | // swift-module-flags: -module-name Z | ||
// CHECK-NEXT: 3 | import missing_module | ||
// CHECK-NEXT: | |- error: Unable to find module dependency: 'missing_module' | ||
// CHECK-NEXT: | |- note: a dependency of Swift module 'Z': '{{.*}}{{/|\\}}Z.swiftinterface' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A follow-up change will associate these notes with their corresponding source location of the importer of the given module in the dependency chain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great enhancement on build logs. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. We need to send more diagnostics location back (like if a syntax error in the main source module).
2a7f2ff
to
5b03799
Compare
5b03799
to
c85a126
Compare
Waiting on apple/llvm-project#8754 to land and auto-merge before this can land. |
@swift-ci test |
c85a126
to
09b641e
Compare
@swift-ci test |
09b641e
to
9ac78b5
Compare
1 similar comment
9ac78b5
to
b738bc4
Compare
b738bc4
to
dbb0757
Compare
1 similar comment
@swift-ci Please Build Toolchain Ubuntu 22.04 |
@swift-ci Please Build Toolchain Ubuntu 22.04 (arm64) |
dbb0757
to
c310947
Compare
…endencies This change modifies the dependency scanner to keep track of source locations of each encountered 'import' statement, in order to be able to emit diagnostics with source locations if an import failed to resolve. - Keep track of each 'import' statement's source buffer, line number, and column number when adding it. The dependency scanner utilizes separate compilation instances, and therefore separate Source Managers for scanning `import` statements of user sources and textual interfaces of Swift dependencies. Since import resolution may happen in the main scanner compilation instance while the `import` itself was found by an interface-scanning sub-instance, we cannot simply hold on to the import's `SourceLoc`. - Add libSwiftScan API for diagnostics to carry above source locations to clients.
c310947
to
9aeadd0
Compare
This change modifies the dependency scanner to keep track of source locations of each encountered
import
statement, in order to be able to emit diagnostics with source locations if an import failed to resolve.import
statement's source buffer, line number, and column number when adding it. The dependency scanner utilizes separate compilation instances, and therefore separate Source Managers for scanningimport
statements of user sources and textual interfaces of Swift dependencies. Since import resolution may happen in the main scanner compilation instance while theimport
itself was found by an interface-scanning sub-instance, we cannot simply hold on to the import'sSourceLoc
.Instead of unlocatable:
we will now get rich output: