Skip to content

Only inject -resource-dir when we actually have a path#950

Open
guitargeek wants to merge 1 commit into
compiler-research:mainfrom
guitargeek:resource_dir
Open

Only inject -resource-dir when we actually have a path#950
guitargeek wants to merge 1 commit into
compiler-research:mainfrom
guitargeek:resource_dir

Conversation

@guitargeek
Copy link
Copy Markdown

Only inject -resource-dir when we actually have a path. An empty value would cause clang to consume the next argument (e.g. "-std=c++14") as the resource-dir value, silently dropping it.

This fixes running the tests in my setup where I use a different Clang version as the default on the system from the one I build CppInterOp against. This makes DetectResourceDir() fail because it just uses the clang executable. One could imagine also to improve DetectResourceDir() to deal with this case, but it's not necessary for now because my setup also works without passing -resource-dir at all (using CppInterOp inside ROOT with Cling).

@guitargeek guitargeek changed the title only inject -resource-dir when we actually have a path Only inject -resource-dir when we actually have a path Apr 29, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.74%. Comparing base (8777014) to head (4b22b07).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #950      +/-   ##
==========================================
- Coverage   81.76%   81.74%   -0.02%     
==========================================
  Files          15       15              
  Lines        4759     4760       +1     
==========================================
  Hits         3891     3891              
- Misses        868      869       +1     
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 88.54% <100.00%> (+<0.01%) ⬆️

... and 1 file with indirect coverage changes

Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 88.54% <100.00%> (+<0.01%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@aaronj0 aaronj0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks!

Only inject -resource-dir when we actually have a path. An empty value
would cause clang to consume the next argument (e.g. "-std=c++14") as
the resource-dir value, silently dropping it.

This fixes running the tests in my setup where I use a different Clang
version as the default on the system from the one I build CppInterOp
against. This makes `DetectResourceDir()` fail because it just uses the
`clang` executable. One could imagine also to improve
`DetectResourceDir()` to deal with this case, but it's not necessary for
now because my setup also works without passing `-resource-dir` at all
(using CppInterOp inside ROOT with Cling).
Comment on lines +3816 to +3818
if (!ResourceDir.empty()) {
ClingArgv.insert(ClingArgv.begin(), {"-resource-dir", ResourceDir.c_str()});
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!ResourceDir.empty()) {
ClingArgv.insert(ClingArgv.begin(), {"-resource-dir", ResourceDir.c_str()});
}
if (!ResourceDir.empty())
ClingArgv.insert(ClingArgv.begin(), {"-resource-dir", ResourceDir.c_str()});

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants