Author: jgorbe
Date: Thu May  9 09:47:07 2019
New Revision: 360355

URL: http://llvm.org/viewvc/llvm-project?rev=360355&view=rev
Log:
[lldb] build.py: fix behavior when passing --compiler=/path/to/compiler

All the other paths in the find_toolchain function return a tuple
(detected_toolchain_type, compiler_path), but when the parameter to
--compiler is not one of the predefined names it only returns the
detected toolchain type, which causes an error when trying to unpack the
result.

This patch changes it to return also the compiler path passed as a
parameter.

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

Added:
    lldb/trunk/lit/BuildScript/compiler-full-path.test
Modified:
    lldb/trunk/lit/helper/build.py

Added: lldb/trunk/lit/BuildScript/compiler-full-path.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/BuildScript/compiler-full-path.test?rev=360355&view=auto
==============================================================================
--- lldb/trunk/lit/BuildScript/compiler-full-path.test (added)
+++ lldb/trunk/lit/BuildScript/compiler-full-path.test Thu May  9 09:47:07 2019
@@ -0,0 +1,10 @@
+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

Modified: lldb/trunk/lit/helper/build.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/helper/build.py?rev=360355&r1=360354&r2=360355&view=diff
==============================================================================
--- lldb/trunk/lit/helper/build.py (original)
+++ lldb/trunk/lit/helper/build.py Thu May  9 09:47:07 2019
@@ -207,16 +207,16 @@ def find_toolchain(compiler, tools_dir):
     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):


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to