@@ -66,29 +66,17 @@ replaceCRLFWithLF(std::string &str)
66
66
}
67
67
}
68
68
69
- SingleFileDB makeSingleFileDBForClang (llvm::StringRef pathName)
69
+ SingleFileDB makeSingleFileDB (llvm::StringRef pathName)
70
70
{
71
71
auto fileName = files::getFileName (pathName);
72
72
auto parentDir = files::getParentDir (pathName);
73
73
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
92
80
tooling::CompileCommand cc (
93
81
parentDir,
94
82
fileName,
@@ -148,12 +136,7 @@ handleFile(
148
136
149
137
// Create an adjusted MrDocsDatabase
150
138
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);
157
140
std::unordered_map<std::string, std::vector<std::string>> defaultIncludePaths;
158
141
MrDocsCompilationDatabase compilations (
159
142
llvm::StringRef (parentDir), db, config, defaultIncludePaths);
0 commit comments