Skip to content

Commit 6949df9

Browse files
committed
clang-format
1 parent 69b338a commit 6949df9

File tree

1 file changed

+21
-34
lines changed

1 file changed

+21
-34
lines changed

src/xinterpreter.cpp

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

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

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-
}
52-
}
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());
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";
5939
}
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"}*/);
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"}*/);
6451
}
6552

6653
using namespace std::placeholders;

0 commit comments

Comments
 (0)