Skip to content

Commit 50eae73

Browse files
committed
Run tests using clang-cl on windows
1 parent 4887496 commit 50eae73

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/lib/SingleFileDB.hpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,25 @@ class SingleFileDB
3030
public:
3131
explicit
3232
SingleFileDB(
33-
llvm::StringRef pathName)
33+
llvm::StringRef pathName, bool is_clang_cl = false)
3434
{
3535
auto fileName = files::getFileName(pathName);
3636
auto parentDir = files::getParentDir(pathName);
3737

3838
std::vector<std::string> cmds;
39-
cmds.emplace_back("clang");
39+
if (is_clang_cl) {
40+
cmds.emplace_back("clang-cl");
41+
cmds.emplace_back("/std:c++latest");
42+
cmds.emplace_back("/permissive-");
43+
cmds.emplace_back("/WX");
44+
}
45+
else {
46+
cmds.emplace_back("clang");
47+
cmds.emplace_back("-std=c++23");
48+
cmds.emplace_back("-pedantic-errors");
49+
cmds.emplace_back("-Werror");
50+
}
4051
cmds.emplace_back("-fsyntax-only");
41-
cmds.emplace_back("-std=c++23");
42-
cmds.emplace_back("-pedantic-errors");
43-
cmds.emplace_back("-Werror");
4452
cmds.emplace_back(fileName);
4553
cc_.emplace_back(
4654
parentDir,

src/test/TestRunner.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,15 @@ handleFile(
114114

115115
// Create an adjusted MrDocsDatabase
116116
auto parentDir = files::getParentDir(filePath);
117+
bool const is_clang_cl =
118+
#if defined(WIN32)
119+
true;
120+
#else
121+
false;
122+
#endif
117123
std::unordered_map<std::string, std::vector<std::string>> defaultIncludePaths;
118124
MrDocsCompilationDatabase compilations(
119-
llvm::StringRef(parentDir), SingleFileDB(filePath), config, defaultIncludePaths);
125+
llvm::StringRef(parentDir), SingleFileDB(filePath, is_clang_cl), config, defaultIncludePaths);
120126

121127
report::debug("Building Corpus", filePath);
122128
auto corpus = CorpusImpl::build(config, compilations);

0 commit comments

Comments
 (0)