Skip to content

Debug Info: Represent macro expansions as inlined functions. #63144

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

Closed
wants to merge 1 commit into from

Conversation

adrian-prantl
Copy link
Contributor

This allows the debugger to choose whether to display the expanded macro
(inlined) or the original source code (parent frame).

rdar://102916513

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome! With this and one tiny fix you mentioned (ensuring that the files we dump have a newline at the end), I'm able to step into a macro expansion. So very cool.

/*Results*/ {}, None, SubstitutionMap(), SubstitutionMap(),
SGM.M.getASTContext());
SILFunction *MacroFn = B.getOrCreateFunction(
Loc, MacroName.getBaseIdentifier().str(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we render the full macro name here, with argument labels? And is this something that will eventually need to be unique?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we should provide the fully mangled name here, then LLDB can render it appropriately. It would also be awesome to emit pattern_binding nodes for all the arguments (if we don't do that already) and associate them with macro arguments as (debug_value(_addr) %0 : $Type, let, name "arg_1", argno 1, loc ...) in SIL.

This allows the debugger to choose whether to display the expanded macro
(inlined) or the original source code (parent frame).

rdar://102916513
@adrian-prantl
Copy link
Contributor Author

@swift-ci test

@adrian-prantl
Copy link
Contributor Author

@swift-ci test and merge

@adrian-prantl
Copy link
Contributor Author

This landed as part of #63125 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants