Skip to content

[C++] data flow node not found #21032

@hello123leo

Description

@hello123leo

g++ version: 4.8.2
codeql version: 2.23.6

main.cpp:

#include "stdint.h"
#include <string>

class Test {
public:
    explicit Test(const uint64_t &id) : id_(id) {}
    
private:
    uint64_t id_;
};

int main(int argc, char* argv[]){
    Test test(123456);
    return 0;
}

create database command:

codeql database create testdb --language=cpp --command='g++ main.cpp -std=c++11' -j 0

query:

from DataFlow::Node n
where n.getLocation().getFile().getBaseName() = "main.cpp"
select n

I can find the data flow node "*constructor init of field id_":

Image

and then i add a string member variable str_ like this(line 9):

#include "stdint.h"
#include <string>

class Test {
public:
    explicit Test(const uint64_t &id) : id_(id) {}
    
private:
    std::string str_{};
    uint64_t id_;
};

int main(int argc, char* argv[]){
    Test test(123456);
    return 0;
}

use the same command to create a new database and the same query to analyze, it seems that i can not find the data flow node "*constructor init of field id_" in the new database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C++questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions