From 0ca4f84f2f550f790d1868df8f6a7dfe8164e171 Mon Sep 17 00:00:00 2001
From: Alex Langford <apl@fb.com>
Date: Mon, 4 Mar 2019 21:36:49 +0000
Subject: [PATCH] [build.py] Allow clang-cl to build files starting with '/U'

Summary:
clang-cl tries to match cl's interface, and treats /U as "Removes a
predefined macro" as cl does. When you feed clang-cl a file that begins with
'/U' (e.g. /Users/xiaobai/foo.c), clang-cl will emit a warning and in some cases
an error, like so:

clang-9: warning: '/Users/xiaobai/foo.c' treated as the '/U' option [-Wslash-u-filename]
clang-9: note: Use '--' to treat subsequent arguments as filenames
clang-9: error: no input files

If you're using clang-cl, make sure '--' is passed before the source file.

Differential Revision: https://reviews.llvm.org/D58860

llvm-svn: 355341
---
 lldb/lit/helper/build.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lldb/lit/helper/build.py b/lldb/lit/helper/build.py
index ec1e6356e437..1b8227d163c3 100755
--- a/lldb/lit/helper/build.py
+++ b/lldb/lit/helper/build.py
@@ -568,6 +568,8 @@ class MsvcBuilder(Builder):
         args.append('/c')
 
         args.append('/Fo' + obj)
+        if self.toolchain_type == 'clang-cl':
+            args.append('--')
         args.append(source)
 
         return ('compiling', [source], obj,