-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[AST] make ASTContext RawComment cache aware of serialization #36829
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
Conversation
@swift-ci Please test |
@swift-ci Please build toolchain macOS platform |
/// This is some func. | ||
public func someFunc() {} | ||
|
||
// CHECK: range |
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.
Is it worth checking the location here in case "range" is added as a key somewhere else?
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.
The problem is that the symbol graphs that come from the compiler are not formatted, so (as far as i know) there’s no easy way to check for a given line range without looking for the entire {“start”:4,”end”:15}
sequence all at once. is there a way to pretty print JSON in a test, or should i just throw the whole sequence into a check condition?
Build failed |
macOS Toolchain Install command |
Linux test failed on Swift/LLDB tests? Going to try again, in case it was a fluke... @swift-ci Please test Linux platform |
Build failed |
Looks like the test i added in #36785 is flakier than anticipated. I'll fix it in this PR. |
4d7aef0
to
34d8995
Compare
@swift-ci Please smoke test |
34d8995
to
2745247
Compare
Resolves rdar://76162972
In situations where different parts of the codebase want to load raw comments, there's an ordering constraint between sections that don't want to load
.swiftsourceinfo
files (for performance reasons) and those that do (for completeness reasons). If a code with the former constraint loads the raw comment first, code with the latter constraint won't know to reload the comment to get all the information available. This caused a situation where emitting symbol graphs while compiling in batch mode (after #36270) would cause doc comments to lose their source-range information.This PR adds a boolean to the RawComment cache in the ASTContext. This indicates whether the RawComment in question came from a
RawDocCommentAttr
or.swiftsourceinfo
file. The existingSerializedOK
flag then compares against the boolean from the cache to determine whether to discard the cached comment information and attempt to load the comment anyway. IfSerializedOK
is false, then the cached comment is used every time. IfSerializedOK
is true, then the cached comment will be used only if it came from the above situations.