• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

daisytuner / docc / 25823993703

13 May 2026 08:16PM UTC coverage: 60.954% (-4.8%) from 65.785%
25823993703

push

github

web-flow
Merge pull request #710 from daisytuner/publish-llvm-frontend

Publish LLVM (C/C++) frontend

2664 of 8267 new or added lines in 27 files covered. (32.22%)

35005 of 57429 relevant lines covered (60.95%)

11126.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/llvm/src/docc_paths.cpp
1
#include "docc/docc_paths.h"
2
#include <llvm/Support/Debug.h>
3

4
#include "docc/cmd_args.h"
5

6
#include <filesystem>
7
#include <memory>
8

9

10
namespace docc::utils {
11

12
std::vector<std::filesystem::path> DoccPaths::target_inc_paths() const {
4✔
13
    switch (root_mode) {
4✔
14
        case DoccRootMode::CMake:
1✔
15
            return {
1✔
16
                docc_root_path / ".." / "docc" / "rtl" / "include",
1✔
17
                docc_root_path / ".." / "docc" / "arg-capture-io" / "include"
1✔
18
            };
1✔
19
        case DoccRootMode::Dist:
1✔
20
            return {docc_root_path / "include"};
1✔
21
        default:
2✔
22
            return {};
2✔
23
    }
4✔
24
}
4✔
25

26
DoccPaths DoccPaths::from_root(const std::string_view &root) {
4✔
27
    std::string_view stripped_root = root;
4✔
28
    if (stripped_root.size() >= 2) {
4✔
29
        if ((stripped_root.starts_with('"') && stripped_root.ends_with('"')) ||
3✔
30
            (stripped_root.starts_with('\'') && stripped_root.ends_with('\''))) {
3✔
NEW
31
            stripped_root = stripped_root.substr(1, stripped_root.size() - 2);
×
NEW
32
        }
×
33
    }
3✔
34

35
    auto idx = stripped_root.find(':');
4✔
36
    if (idx > 0) {
4✔
37
        auto type = stripped_root.substr(0, idx);
4✔
38
        std::filesystem::path path = stripped_root.substr(idx + 1);
4✔
39
        if (type == "CMake") {
4✔
40
            return {
1✔
41
                .root_mode = DoccRootMode::CMake,
1✔
42
                .docc_root_path = path,
1✔
43
            };
1✔
44
        } else if (type == "Dist") {
3✔
45
            return {
1✔
46
                .root_mode = DoccRootMode::Dist,
1✔
47
                .docc_root_path = path,
1✔
48
            };
1✔
49
        } else {
2✔
50
            LLVM_DEBUG_PRINTLN("DOCC Root undefined. Expecting resources on paths");
2✔
51
            return {
2✔
52
                .root_mode = DoccRootMode::None,
2✔
53
                .docc_root_path = "",
2✔
54
            };
2✔
55
        }
2✔
56
    } else {
4✔
NEW
57
        LLVM_DEBUG_PRINTLN("Invalid DOCC Root. Expecting resources on paths");
×
NEW
58
        return {
×
NEW
59
            .root_mode = DoccRootMode::None,
×
NEW
60
            .docc_root_path = "",
×
NEW
61
        };
×
NEW
62
    }
×
63
}
4✔
64

NEW
65
DoccPaths DoccPaths::get_instance() {
×
NEW
66
    auto root = DOCC_ROOT.getValue();
×
NEW
67
    static DoccPaths instance = DoccPaths::from_root(root);
×
NEW
68
    return instance;
×
NEW
69
}
×
70

NEW
71
std::string getEnv(std::string const &key) {
×
NEW
72
    char *val = std::getenv(key.c_str());
×
NEW
73
    return val == NULL ? std::string("") : std::string(val);
×
NEW
74
};
×
75

NEW
76
std::filesystem::path get_docc_work_dir() {
×
NEW
77
    auto argDir = DOCC_WORK_DIR.getValue();
×
NEW
78
    if (argDir.starts_with('"') || argDir.starts_with('\'')) {
×
NEW
79
        argDir = argDir.substr(1, argDir.size() - 2);
×
NEW
80
    }
×
81

NEW
82
    if (argDir.empty()) { // backup in case somebody calls us without going through the driver, does not need to be
×
83
                          // perfect!
NEW
84
        auto baseDir = get_work_base_dir();
×
85

NEW
86
        auto pid = std::to_string(getpid());
×
NEW
87
        auto wDir = baseDir / pid;
×
NEW
88
        return wDir;
×
NEW
89
    } else {
×
NEW
90
        return argDir;
×
NEW
91
    }
×
NEW
92
}
×
93

NEW
94
std::filesystem::path get_work_base_dir() {
×
NEW
95
    auto tmpBaseDirStr = getEnv("DOCC_TMP");
×
NEW
96
    std::filesystem::path tmpBaseDir;
×
NEW
97
    if (tmpBaseDirStr.empty()) {
×
NEW
98
        auto userName = getEnv("USER");
×
NEW
99
        tmpBaseDir = std::filesystem::path("/tmp") / userName / "DOCC";
×
NEW
100
    } else {
×
NEW
101
        tmpBaseDir = std::filesystem::path(tmpBaseDirStr);
×
NEW
102
    }
×
NEW
103
    return tmpBaseDir;
×
NEW
104
}
×
105

106
} // namespace docc::utils
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc