Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 357f5d1

Browse files
committedMay 23, 2025
clang-format
1 parent 6949df9 commit 357f5d1

File tree

1 file changed

+34
-21
lines changed

1 file changed

+34
-21
lines changed
 

‎src/xinterpreter.cpp

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,41 @@
2626

2727
using Args = std::vector<const char*>;
2828

29-
void* createInterpreter(const Args &ExtraArgs = {}) {
30-
Args ClangArgs = {/*"-xc++"*/"-v"};
31-
if (std::find_if(ExtraArgs.begin(), ExtraArgs.end(), [](const std::string& s) {
32-
return s == "-resource-dir";}) == ExtraArgs.end()) {
33-
std::string resource_dir = Cpp::DetectResourceDir();
34-
if (!resource_dir.empty()) {
35-
ClangArgs.push_back("-resource-dir");
36-
ClangArgs.push_back(resource_dir.c_str());
37-
} else {
38-
std::cerr << "Failed to detect the resource-dir\n";
29+
void* createInterpreter(const Args& ExtraArgs = {})
30+
{
31+
Args ClangArgs = {/*"-xc++"*/ "-v"};
32+
if (std::find_if(
33+
ExtraArgs.begin(),
34+
ExtraArgs.end(),
35+
[](const std::string& s)
36+
{
37+
return s == "-resource-dir";
38+
}
39+
)
40+
== ExtraArgs.end())
41+
{
42+
std::string resource_dir = Cpp::DetectResourceDir();
43+
if (!resource_dir.empty())
44+
{
45+
ClangArgs.push_back("-resource-dir");
46+
ClangArgs.push_back(resource_dir.c_str());
47+
}
48+
else
49+
{
50+
std::cerr << "Failed to detect the resource-dir\n";
51+
}
3952
}
40-
}
41-
std::vector<std::string> CxxSystemIncludes;
42-
Cpp::DetectSystemCompilerIncludePaths(CxxSystemIncludes);
43-
for (const std::string& CxxInclude : CxxSystemIncludes) {
44-
ClangArgs.push_back("-isystem");
45-
ClangArgs.push_back(CxxInclude.c_str());
46-
}
47-
ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
48-
// FIXME: We should process the kernel input options and conditionally pass
49-
// the gpu args here.
50-
return Cpp::CreateInterpreter(ClangArgs/*, {"-cuda"}*/);
53+
std::vector<std::string> CxxSystemIncludes;
54+
Cpp::DetectSystemCompilerIncludePaths(CxxSystemIncludes);
55+
for (const std::string& CxxInclude : CxxSystemIncludes)
56+
{
57+
ClangArgs.push_back("-isystem");
58+
ClangArgs.push_back(CxxInclude.c_str());
59+
}
60+
ClangArgs.insert(ClangArgs.end(), ExtraArgs.begin(), ExtraArgs.end());
61+
// FIXME: We should process the kernel input options and conditionally pass
62+
// the gpu args here.
63+
return Cpp::CreateInterpreter(ClangArgs /*, {"-cuda"}*/);
5164
}
5265

5366
using namespace std::placeholders;

0 commit comments

Comments
 (0)