Skip to content

Conversation

@mingxwa
Copy link
Member

@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
RonaldRizz added a commit to RonaldRizz/proxy that referenced this pull request Nov 23, 2024
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