Skip to content

Commit d14c59c

Browse files
committed
fixup
1 parent 2228db4 commit d14c59c

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/lib/MrDocsCompilationDatabase.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,13 @@ adjustCommandLine(
303303
cmdLineCStrs.data() + cmdLineCStrs.size());
304304

305305
char const* systemIncludeFlag = is_clang_cl ? "-external:I" : "-isystem";
306-
// FIXME: No CL equivalent, but not really needed there?
306+
// FIXME: No CL equivalent, and not really needed for the microsoft system
307+
// headers, but other users could depend on this.
307308
char const* afterIncludeFlag = is_clang_cl ? "-external:I" : "-idirafter";
308-
309+
char const* latestCxxStandardFlag = is_clang_cl ? "-std:c++latest" : "-std=c++26";
310+
char const* latestCStandardFlag = is_clang_cl ? "-std:clatest" : "-std=c23";
311+
char const* noStdlibFlag = is_clang_cl ? "-X" : "-nostdinc++";
312+
char const* noSystemLibFlag = is_clang_cl ? "-X" : "-nostdlibinc";
309313

310314
// ------------------------------------------------------
311315
// Supress all warnings
@@ -351,12 +355,11 @@ adjustCommandLine(
351355
{
352356
if (!isCCompileCommand)
353357
{
354-
new_cmdline.emplace_back(
355-
is_clang_cl ? "-std:c++latest" : "-std=c++26");
358+
new_cmdline.emplace_back(latestCxxStandardFlag);
356359
}
357360
else
358361
{
359-
new_cmdline.emplace_back(is_clang_cl ? "-std:clatest" : "-std=c23");
362+
new_cmdline.emplace_back(latestCStandardFlag);
360363
}
361364
}
362365

@@ -399,7 +402,7 @@ adjustCommandLine(
399402
// implicit include paths and add the standard library
400403
// and system includes manually. That gives MrDocs
401404
// access to libc++ in a portable way.
402-
new_cmdline.emplace_back(is_clang_cl ? "-X" : "-nostdinc++");
405+
new_cmdline.emplace_back(noStdlibFlag);
403406
for (auto const& inc : (*config)->stdlibIncludes)
404407
{
405408
new_cmdline.emplace_back(systemIncludeFlag);
@@ -409,7 +412,7 @@ adjustCommandLine(
409412

410413
if (!(*config)->useSystemLibc)
411414
{
412-
new_cmdline.emplace_back(is_clang_cl ? "-X" : "-nostdlibinc");
415+
new_cmdline.emplace_back(noSystemLibFlag);
413416
for (auto const& inc : (*config)->libcIncludes)
414417
{
415418
new_cmdline.emplace_back(afterIncludeFlag);

0 commit comments

Comments
 (0)