From 83f7f10c3bec459a00d929b9f0082a7ea078200f Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Wed, 9 Feb 2022 01:28:05 -0800 Subject: [PATCH] fix: support clang-cl's /Fo option --- clang/clangArgumentParser.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/clang/clangArgumentParser.go b/clang/clangArgumentParser.go index a1b6922..cf414b8 100644 --- a/clang/clangArgumentParser.go +++ b/clang/clangArgumentParser.go @@ -34,12 +34,19 @@ func ParseClangCommandString(commands string) (*CompilerCommand, error) { continue } - if words[i] == "-o" && (i+1) < len(words) { + if (words[i] == "-o" || words[i] == "/Fo") && (i+1) < len(words) { cmd.OutputPath = words[i+1] i += 2 continue } + // For clang-cl, check if word starts with /Fo, if so, strip it + if strings.HasPrefix(words[i], "/Fo") { + cmd.OutputPath = words[i][3:] + i += 2 + continue + } + // all other arguments are just passed to the argument list cmd.Arguments = append(cmd.Arguments, words[i]) i++