Skip to content

Commit 5ff2773

Browse files
authored
[clang-cl] Allow a colon after /Fo option (#87209)
Modeled after 8513a68 According to https://learn.microsoft.com/en-us/cpp/build/reference/fo-object-file-name?view=msvc-170, `/Fo` accepts a trailing-colon variant. This is also tested in practice. This allows clang-cl to parse this. I just copied one of the existing tests, let me know if this is not the best way to do this. I tested that the test does not pass beofre the Options.td change, and that it does after. See also #46065
1 parent 4746877 commit 5ff2773

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8313,6 +8313,7 @@ def _SLASH_Fi : CLCompileJoined<"Fi">,
83138313
def _SLASH_Fo : CLCompileJoined<"Fo">,
83148314
HelpText<"Set output object file (with /c)">,
83158315
MetaVarName<"<file or dir/>">;
8316+
def _SLASH_Fo_COLON : CLCompileJoined<"Fo:">, Alias<_SLASH_Fo>;
83168317
def _SLASH_guard : CLJoined<"guard:">,
83178318
HelpText<"Enable Control Flow Guard with /guard:cf, or only the table with /guard:cf,nochecks. "
83188319
"Enable EH Continuation Guard with /guard:ehcont">;

clang/test/Driver/cl-outputs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,5 +301,8 @@
301301
// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1 %s
302302
// RELATIVE_OBJPATH1: "-object-file-name=a.obj"
303303

304+
// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fo:a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1_COLON %s
305+
// RELATIVE_OBJPATH1_COLON: "-object-file-name=a.obj"
306+
304307
// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fofoo/a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH2 %s
305308
// RELATIVE_OBJPATH2: "-object-file-name=foo\\a.obj"

0 commit comments

Comments
 (0)