Skip to content

bugfix for using bear #46

Open
Open
@questor

Description

@questor

Hi, when using bear (https://github.com/rizsotto/Bear) you get compile_commands.jsons without the command json object but with an "arguments" array. this patch will check if the command object is available and if not create it out of the arguments array:

CompileCommandsCompilationUnitsParser.cpp: (Line 116):
CompilationUnit cu;

        if(cmdJson.find("command") == cmdJson.end()) {
            //no command object available, create one from the arguments object
            auto args = cmdJson["arguments"];
            bool firstRun = true;
            for(json::iterator it = args.begin(); it != args.end(); ++it) {
                if(!firstRun) {
                    cu.compilationCommandStr += " ";
                }
                firstRun = false;
                cu.compilationCommandStr += *it;
            }
        } else {
            cu.compilationCommandStr = cmdJson["command"];
        }

        auto dirPath = TeenyPath::path(cmdJson["directory"].get<std::string>());
        if (dirPath.exists()) {
            dirPath = dirPath.resolve_absolute();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions