-
Notifications
You must be signed in to change notification settings - Fork 10.5k
AST,Sema: track and emit un-deserialized members #40994
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 |
include/swift/AST/ASTContext.h
Outdated
@@ -338,6 +338,9 @@ class ASTContext final { | |||
llvm::SmallPtrSet<DerivativeAttr *, 1>> | |||
DerivativeAttrs; | |||
|
|||
llvm::DenseMap<ClassDecl *, llvm::SmallVector<DeclName, 2>> | |||
MissingClassVTableEntries; |
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.
Can you store the DeclName in the MissingMemberDecl instead of adding another table to the ASTContext?
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.
While possible to iterate the members and pull out the MissingMemberDecl
, it may limit any additional context from being saved off (due to Decl
s being bump ptr allocated). If you still think that it's better to do it that way, LMK and I can change this pretty easily.
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.
Can you explain what you mean by limiting context from being saved off?
What I'm suggesting is iterating over the members in TypeCheckDeclPrimary, yeah.
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.
Adding any additional context like the XRefTrace or the module which failed to load would not be possible AIUI. (Anything that is not trivially destructible is not embeddable).
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.
I think you can store that context in the MissingMemberDecl itself (it's fine for bump-allocated Decls to point to other things. You can either bump-allocate the additional context, or heap-allocate it and register a global destructor with the ASTContext on the MissingMemberDecl field in question).
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.
SGTM
Build failed |
Build failed |
This adds tracking of the vtable holes due to a failure to deserialize vtable entries. This allows for the user to be able to identify what member failed to be deserialied and can aid in understanding why an `open` class may not be subclassed. Future improvements here would allow tracing the XRefPath which failed to be deserialied. However, this still provides an improvement over the existing experience where there is no available information on why the class cannot be inherited from.
87ee5bd
to
86de45a
Compare
@swift-ci please test |
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.
This new version is much cleaner in my opinion -- thank you for considering the change!
Build failed |
@swift-ci please test macOS platform |
I wasn't particularly enthused by the use of |
// RUN: %empty-directory(%t) | ||
// RUN: %empty-directory(%t/swift) | ||
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/swift/SwiftLibrary.swiftmodule %s -module-name SwiftLibrary -I%S/Inputs | ||
// RUN: %target-typecheck-verify-swift -DCLIENT -c %s -module-name client -I%t/swift |
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.
What does -c
do? I couldn't find it in either options list.
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.
It's an alias for -emit-object
: https://github.com/apple/swift/blob/ac875d00f04126d8a579e307d052df9752a18286/include/swift/Option/Options.td#L1015-L1016
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.
Thanks, should have looked at the modes too.
This adds tracking of the vtable holes due to a failure to deserialize
vtable entries. This allows for the user to be able to identify what
member failed to be deserialied and can aid in understanding why an
open
class may not be subclassed.Future improvements here would allow tracing the XRefPath which failed
to be deserialied. However, this still provides an improvement over the
existing experience where there is no available information on why the
class cannot be inherited from.
Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.
Resolves SR-NNNN.