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

[c++] Function overloading causes call graph to use the wrong function #10730

Open
freemedom opened this issue Mar 11, 2024 · 2 comments
Open

Comments

@freemedom
Copy link

freemedom commented Mar 11, 2024

Describe the bug
Function overloading causes call graph to use the wrong function

Screenshots
image
image
image

To Reproduce
testDoxygen.zip

static bool setup_bcb(const int socket) {
......
    std::vector<std::string> options = android::base::Split(content, "\n");
    std::string wipe_package;
    for (auto& option : options) {
        if (android::base::StartsWith(option, "--wipe_package=")) {
            std::string path = option.substr(strlen("--wipe_package="));
            if (!android::base::ReadFileToString(path, &wipe_package)) {
                PLOG(ERROR) << "failed to read " << path;
                return false;
            }
            option = android::base::StringPrintf("--wipe_package_size=%zu", wipe_package.size());
        }
    }

    // c8. setup the bcb command
    std::string err;
    if (!write_bootloader_message(options, &err)) { // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        LOG(ERROR) << "failed to set bootloader message: " << err;
        write_status_to_socket(-1, socket);
        return false;
    }
......
}

Expected behavior
use bool write_bootloader_message(const std::vector<std::string>& options, std::string* err) not bool write_bootloader_message(const bootloader_message& boot, std::string* err)

Version
1.10.0 (ebc57c6)

Stack trace

Additional context

@freemedom freemedom changed the title Function overloading causes call graph to use the wrong function [c++] Function overloading causes call graph to use the wrong function Mar 11, 2024
@albert-github
Copy link
Collaborator

When I understand it correctly you mean that in the call graph of setup_bcb the reference to write_bootloader_message should not point to the 1/3 overload of write_bootloader_message but to the 3/3 overload.

This is indeed not correct but also a known issue.

The settings file is missing,, I could reproduce the problem with the settings:

QUIET = YES
EXTRACT_ALL = YES
EXTRACT_STATIC = YES
RECURSIVE = YES
HAVE_DOT = YES
CALL_GRAPH = YES
CALLER_GRAPH = YES

in future please always add the settings (the result of doxygen -x Doxyfile to the example.

@freemedom
Copy link
Author

@albert-github Yes, that's what I mean. (I'm not very good at English.)

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

No branches or pull requests

2 participants