-
Notifications
You must be signed in to change notification settings - Fork 344
[lldb] Fix an incorrect trigger of a per-module scratch context #9349
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
[lldb] Fix an incorrect trigger of a per-module scratch context #9349
Conversation
which indirectly caused several ModuleSP shared pointers to live longer than two tests expected them to. The problem is that swift::performImportResolution() now apparently also reports syntax errors in function bodies, so I had to add a (terrible) heuristic to filter out actual module import errors. rdar://135575668
@swift-ci test |
std::string msg = llvm::toString(expr_diagnostics.GetAllErrors()); | ||
if (StringRef(msg).contains(": could not build module ")) | ||
return make_error<ModuleImportError>(msg); | ||
return llvm::createStringError(msg); |
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.
nit: let's std::move(msg)
here and above, since those are likely big strings.
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 this not an optimization that Clang can do on its own?
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.
Nope, not in the middle of an expression. Clang will move when you have a naked return. E.g. imagine you had an Error
class (which cannot be copied) instead of a string, this compiles:
return error;
but this doesn't compile:
return foo(error);
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 seems a bit scary that there is a connection between the problem and this fix, but I don't have enough knowledge about these to propose a long term solution.
Thank you and Jim for investigating this! |
Good question! The fallback mechanism that caused this is a bit of an anachronism in the days of precise compiler invocations, and I'm thinking hard about removing it completely to simplify the code. |
97e95e0
into
swiftlang:stable/20240723
which indirectly caused several ModuleSP shared pointers to live longer than two tests expected them to.
The problem is that swift::performImportResolution() now apparently also reports syntax errors in function bodies, so I had to add a (terrible) heuristic to filter out actual module import errors.
rdar://135575668