-
Notifications
You must be signed in to change notification settings - Fork 344
[lldb] add de-duplication and working dir support for fmodule-file #4039
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
This PR adds correct handling of the `-fmodule-file=` flag. This flag is of the form `-fmodule-file=[<name>=]<file>`, so we need to split on the final = to get the path component in all cases.
@swift-ci test |
// We need special handling for -fmodule-file as we need to | ||
// split on the final = after the module name. | ||
if (arg.startswith("-fmodule-file=")) { | ||
prefix = arg.substr(0, arg.rfind("=") + 1); |
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 assume this is safe, even if arg is either "foo", or "foo="?
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 two valid cases are -fmodule-file=some/path
and -fmodule-file=modulename=some/path
. We know the first =
is present as we checked the prefix above, so this will split correctly in both cases. There is no form -fmodule-file some/path
so we don't need to handle that case.
|
||
// fmodule-file needs to handle different cases: | ||
// -fmodule-file=path/to/pcm | ||
// -fmodule-file=name=path/to/pcm |
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.
here it says -fmodule-file=name=path/to/pcm
but all the tests use -fmodule-file=modulename=path/to/pcm
is that a tricky test for the edge-case of passing in something that ends with name=
or a typo?
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!
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 name
string can be anything, it is used to indicate the name of the module that you are providing the path to. I can make these the same if you think it is clearer? It shouldn't make any difference to the flag splitting logic though.
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.
Oh, this isn't a key=value pair whre the key is "name", it's [name of the module]=[file name]!
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.
Exactly, yes. I believe the idea is that the compiler can avoid loading pcm files until they are imported.
This PR adds correct handling of the
-fmodule-file=
flag whendeserializing Swift debugging info. This flag is of the form
-fmodule-file=[<name>=]<file>
, so we need to split on the final=
to get the path component in all cases.