Skip to content

Commit 7e1d474

Browse files
committed
silence warning
1 parent e0afec9 commit 7e1d474

File tree

1 file changed

+8
-25
lines changed

1 file changed

+8
-25
lines changed

src/test/TestRunner.cpp

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -66,29 +66,17 @@ replaceCRLFWithLF(std::string &str)
6666
}
6767
}
6868

69-
SingleFileDB makeSingleFileDBForClang(llvm::StringRef pathName)
69+
SingleFileDB makeSingleFileDB(llvm::StringRef pathName)
7070
{
7171
auto fileName = files::getFileName(pathName);
7272
auto parentDir = files::getParentDir(pathName);
7373

74-
std::vector<std::string> cmds = {"clang",
75-
"-std=c++23", "-pedantic-errors", "-Werror", std::string{fileName}};
76-
tooling::CompileCommand cc(
77-
parentDir,
78-
fileName,
79-
std::move(cmds),
80-
parentDir);
81-
cc.Heuristic = "unit test";
82-
return SingleFileDB(std::move(cc));
83-
}
84-
85-
SingleFileDB makeSingleFileDBForClangCL(llvm::StringRef pathName)
86-
{
87-
auto fileName = files::getFileName(pathName);
88-
auto parentDir = files::getParentDir(pathName);
89-
90-
std::vector<std::string> cmds = {"clang-cl",
91-
"/std:c++latest", "/permissive-", "/WX", std::string{fileName}};
74+
std::vector<std::string> cmds =
75+
#if defined(WIN32)
76+
{"clang-cl", "/std:c++latest", "/permissive-", "/WX", std::string{fileName}};
77+
#else
78+
{"clang", "-std=c++23", "-pedantic-errors", "-Werror", std::string{fileName}};
79+
#endif
9280
tooling::CompileCommand cc(
9381
parentDir,
9482
fileName,
@@ -148,12 +136,7 @@ handleFile(
148136

149137
// Create an adjusted MrDocsDatabase
150138
auto parentDir = files::getParentDir(filePath);
151-
SingleFileDB const db =
152-
#if defined(WIN32)
153-
makeSingleFileDBForClangCL(filePath);
154-
#else
155-
makeSingleFileDBForClang(filePath);
156-
#endif
139+
SingleFileDB const db = makeSingleFileDB(filePath);
157140
std::unordered_map<std::string, std::vector<std::string>> defaultIncludePaths;
158141
MrDocsCompilationDatabase compilations(
159142
llvm::StringRef(parentDir), db, config, defaultIncludePaths);

0 commit comments

Comments
 (0)