-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
- Native case
-
We always will be providing it from kernel.jsoN. So this block looks redundant
Lines 34 to 41 in 48767d6
if (std::find_if(ExtraArgs.begin(), ExtraArgs.end(), [](const std::string& s) { return s == "-resource-dir";}) == ExtraArgs.end()) { std::string resource_dir = Cpp::DetectResourceDir(); if (resource_dir.empty()) std::cerr << "Failed to detect the resource-dir\n"; ClangArgs.push_back("-resource-dir"); ClangArgs.push_back(resource_dir.c_str()); } -
Even if it is not redundant, it would fail (cause there's an implementation logical error I think)
std::string resource_dir = Cpp::DetectResourceDir(); // we don't pass anything here
// function from cppinterop is framed like this
std::string DetectResourceDir(const char* ClangBinaryName /* = clang */) {
std::string cmd = std::string(ClangBinaryName) + " -print-resource-dir";
std::vector<std::string> outs;
exec(cmd.c_str(), outs);
if (outs.empty() || outs.size() > 1)
return "";
......
Here ClangBinaryName would end up being empty as we're not passing anything (probably should pass "clang") and hence this would return an empty string resulting in std::cerr << "Failed to detect the resource-dir\n"; this error being executed.
- After this I see more duplication in how cppinterop creates the interpreter
I see
TInterp_t CreateInterpreter(const std::vector<const char*>& Args /*={}*/,
const std::vector<const char*>& GpuArgs /*={}*/) {
std::string MainExecutableName =
sys::fs::getMainExecutable(nullptr, nullptr);
std::string ResourceDir = MakeResourcesPath();
std::vector<const char *> ClingArgv = {"-resource-dir", ResourceDir.c_str(),
"-std=c++14"};
ClingArgv.insert(ClingArgv.begin(), MainExecutableName.c_str());
........
ClingArgv.insert(ClingArgv.end(), Args.begin(), Args.end());
......
Shouldn't we prefer having (possibly also checking if the -std=... flag is also covered already)
std::vector<const char *> ClingArgv = {"-std=c++14"};
if (std::find_if(Args.begin(), Args.end(), [](const char* s) {
return std::string(s) == "-resource-dir";}) == Args.end()) {
std::string ResourceDir = MakeResourcesPath();
ClingArgv.insert(ClingArgv.begin(), "-resource-dir");
ClingArgv.insert(ClingArgv.begin() + 1, ResourceDir.c_str());
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working