Skip to content

Commit

Permalink
[clang-cl] Allow a colon after /Fo option (#87209)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
russelltg committed Apr 1, 2024
1 parent 4746877 commit 5ff2773
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -8313,6 +8313,7 @@ def _SLASH_Fi : CLCompileJoined<"Fi">,
def _SLASH_Fo : CLCompileJoined<"Fo">,
HelpText<"Set output object file (with /c)">,
MetaVarName<"<file or dir/>">;
def _SLASH_Fo_COLON : CLCompileJoined<"Fo:">, Alias<_SLASH_Fo>;
def _SLASH_guard : CLJoined<"guard:">,
HelpText<"Enable Control Flow Guard with /guard:cf, or only the table with /guard:cf,nochecks. "
"Enable EH Continuation Guard with /guard:ehcont">;
Expand Down
3 changes: 3 additions & 0 deletions clang/test/Driver/cl-outputs.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,5 +301,8 @@
// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Foa.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1 %s
// RELATIVE_OBJPATH1: "-object-file-name=a.obj"

// RUN: %clang_cl -fdebug-compilation-dir=. /Z7 /Fo:a.obj -### -- %s 2>&1 | FileCheck -check-prefix=RELATIVE_OBJPATH1_COLON %s
// RELATIVE_OBJPATH1_COLON: "-object-file-name=a.obj"

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

0 comments on commit 5ff2773

Please sign in to comment.