Skip to content
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

Improve accessibility in debugging for free functions #202

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

mingxwa
Copy link
Collaborator

@mingxwa mingxwa commented Nov 19, 2024

Motivation

Similar to #200, implemented a mechanism to guide compilers to generate code for unused free functions to facilitate debugging.

Changes

  • For each built-in dispatch type that generates a free function (including operators) for accessibility, enabled symbol generation by creating a private static function _symbol_guard in its accessor type to invoke the free function via ADL.

Verification

Build the following code with MSVC in debug mode (without using the value of proxy in the code):

#include <string>

#include "proxy.h"

PRO_DEF_FREE_DISPATCH(FreeToString, std::to_string, ToString);

struct Stringable : pro::facade_builder
  ::add_convention<FreeToString, std::string() const>
  ::build {};

int main() {
  int v = 123;
  pro::proxy<Stringable> p = &v;
}

Set a breakpoint at the end of main and inspect the value of p in the debugger. The debugger invokes the correct function for me.

image

@mingxwa mingxwa merged commit 0b075c7 into microsoft:main Nov 20, 2024
7 checks passed
@mingxwa mingxwa deleted the user/mingxwa/free-function-a11y branch November 20, 2024 03:52
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.

3 participants