[Lldb-commits] [PATCH] D61713: [lldb] build.py: fix behavior when passing --compiler=/path/to/compiler

Jorge Gorbe Moya via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 9 09:38:14 PDT 2019


jgorbe updated this revision to Diff 198853.
jgorbe added a comment.

Added a new test that checks that, when a full path to a compiler is specified:

- That compiler is used in build commands
- The flag style used in build commands matches the toolchain type autodetected from the compiler executable name


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61713/new/

https://reviews.llvm.org/D61713

Files:
  lldb/lit/BuildScript/compiler-full-path.test
  lldb/lit/helper/build.py


Index: lldb/lit/helper/build.py
===================================================================
--- lldb/lit/helper/build.py
+++ lldb/lit/helper/build.py
@@ -207,16 +207,16 @@
     file = os.path.basename(compiler)
     name, ext = os.path.splitext(file)
     if file.lower() == 'cl.exe':
-        return 'msvc'
+        return ('msvc', compiler)
     if name == 'clang-cl':
-        return 'clang-cl'
+        return ('clang-cl', compiler)
     if name.startswith('clang'):
-        return 'clang'
+        return ('clang', compiler)
     if name.startswith('gcc') or name.startswith('g++'):
-        return 'gcc'
+        return ('gcc', compiler)
     if name == 'cc' or name == 'c++':
-        return 'generic'
-    return 'unknown'
+        return ('generic', compiler)
+    return ('unknown', compiler)
 
 class Builder(object):
     def __init__(self, toolchain_type, args, obj_ext):
Index: lldb/lit/BuildScript/compiler-full-path.test
===================================================================
--- /dev/null
+++ lldb/lit/BuildScript/compiler-full-path.test
@@ -0,0 +1,12 @@
+RUN: %build -n --verbose --arch=64 --compiler=/path/to/my/clang -o foo \
+RUN:    foobar.c | FileCheck %s --check-prefix=CHECK-CLANG
+RUN: %build -n --verbose --arch=64 --compiler=/path/to/my/x64/cl.exe -o foo \
+RUN:    foobar.c | FileCheck %s --check-prefix=CHECK-MSVC
+
+CHECK-CLANG: Command Line: /path/to/my/clang
+CHECK-SAME: -o
+
+CHECK-MSVC: Command Line: /path/to/my/x64/cl.exe
+CHECK-SAME: /Fo
+
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61713.198853.patch
Type: text/x-patch
Size: 1503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190509/ce98787a/attachment.bin>


More information about the lldb-commits mailing list