[Lldb-commits] [PATCH] D58860: [build.py] Allow clang-cl to build files starting with '/U'

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 1 17:14:55 PST 2019


xiaobai created this revision.
xiaobai added reviewers: zturner, labath.
Herald added a reviewer: serge-sans-paille.

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.


https://reviews.llvm.org/D58860

Files:
  lit/helper/build.py


Index: lit/helper/build.py
===================================================================
--- lit/helper/build.py
+++ lit/helper/build.py
@@ -568,6 +568,8 @@
         args.append('/c')
 
         args.append('/Fo' + obj)
+        if self.toolchain_type == 'clang-cl':
+            args.append('--')
         args.append(source)
 
         return ('compiling', [source], obj,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58860.189015.patch
Type: text/x-patch
Size: 380 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190302/03a2d2a3/attachment.bin>


More information about the lldb-commits mailing list