llunak updated this revision to Diff 287451.
llunak added a comment.

Updated to not use environment variable.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D86416

Files:
  lldb/packages/Python/lldbsuite/test/configuration.py
  lldb/packages/Python/lldbsuite/test/dotest.py
  lldb/packages/Python/lldbsuite/test/dotest_args.py
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/test/API/lit.cfg.py
  lldb/test/API/lit.site.cfg.py.in

Index: lldb/test/API/lit.site.cfg.py.in
===================================================================
--- lldb/test/API/lit.site.cfg.py.in
+++ lldb/test/API/lit.site.cfg.py.in
@@ -12,6 +12,7 @@
 config.lldb_src_root = "@LLDB_SOURCE_DIR@"
 config.lldb_libs_dir = "@LLDB_LIBS_DIR@"
 config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@"
+config.libcxx_used = @LLVM_LIBCXX_USED@
 config.host_os = "@HOST_OS@"
 config.host_triple = "@LLVM_HOST_TRIPLE@"
 config.shared_libs = @LLVM_ENABLE_SHARED_LIBS@
Index: lldb/test/API/lit.cfg.py
===================================================================
--- lldb/test/API/lit.cfg.py
+++ lldb/test/API/lit.cfg.py
@@ -188,6 +188,9 @@
 if config.lldb_libs_dir:
   dotest_cmd += ['--lldb-libs-dir', config.lldb_libs_dir]
 
+if config.libcxx_used:
+  dotest_cmd += ['--libcxx-used']
+
 if 'lldb-repro-capture' in config.available_features or \
     'lldb-repro-replay' in config.available_features:
   dotest_cmd += ['--skip-category=lldb-vscode', '--skip-category=std-module']
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1476,6 +1476,8 @@
             stdlibflag = "-stdlib=libc++"
         else:  # this includes NetBSD
             stdlibflag = ""
+        if configuration.libcxx_used:
+            stdlibflag = "-stdlib=libc++"
         return stdlibflag
 
     def getstdFlag(self):
@@ -1532,12 +1534,13 @@
         """Platform specific way to build a default library. """
 
         stdflag = self.getstdFlag()
+        stdlibflag = self.getstdlibFlag()
 
         lib_dir = configuration.lldb_libs_dir
         if self.hasDarwinFramework():
             d = {'DYLIB_CXX_SOURCES': sources,
                  'DYLIB_NAME': lib_name,
-                 'CFLAGS_EXTRAS': "%s -stdlib=libc++" % stdflag,
+                 'CFLAGS_EXTRAS': "%s %s" % (stdflag, stdlibflag),
                  'FRAMEWORK_INCLUDES': "-F%s" % self.framework_dir,
                  'LD_EXTRAS': "%s -Wl,-rpath,%s -dynamiclib" % (self.dsym, self.framework_dir),
                  }
@@ -1545,19 +1548,21 @@
             d = {
                 'DYLIB_CXX_SOURCES': sources,
                 'DYLIB_NAME': lib_name,
-                'CFLAGS_EXTRAS': "%s -I%s " % (stdflag,
-                                               os.path.join(
-                                                   os.environ["LLDB_SRC"],
-                                                   "include")),
+                'CFLAGS_EXTRAS': "%s %s -I%s " % (stdflag,
+                                                  stdlibflag,
+                                                  os.path.join(
+                                                      os.environ["LLDB_SRC"],
+                                                      "include")),
                 'LD_EXTRAS': "-shared -l%s\liblldb.lib" % self.os.environ["LLDB_IMPLIB_DIR"]}
         else:
             d = {
                 'DYLIB_CXX_SOURCES': sources,
                 'DYLIB_NAME': lib_name,
-                'CFLAGS_EXTRAS': "%s -I%s -fPIC" % (stdflag,
-                                                    os.path.join(
-                                                        os.environ["LLDB_SRC"],
-                                                        "include")),
+                'CFLAGS_EXTRAS': "%s %s -I%s -fPIC" % (stdflag,
+                                                       stdlibflag,
+                                                       os.path.join(
+                                                           os.environ["LLDB_SRC"],
+                                                           "include")),
                 'LD_EXTRAS': "-shared -L%s -llldb -Wl,-rpath,%s" % (lib_dir, lib_dir)}
         if self.TraceOn():
             print(
Index: lldb/packages/Python/lldbsuite/test/dotest_args.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -177,6 +177,11 @@
         dest='lldb_libs_dir',
         metavar='path',
         help='The path to LLDB library directory (containing liblldb)')
+    group.add_argument(
+        '--libcxx-used',
+        dest='libcxx_used',
+        metavar='libc++ used',
+        help='Whether to force use of libc++ when using liblldb')
     group.add_argument(
         '--enable-plugin',
         dest='enabled_plugins',
Index: lldb/packages/Python/lldbsuite/test/dotest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -440,6 +440,9 @@
     if args.lldb_libs_dir:
         configuration.lldb_libs_dir = args.lldb_libs_dir
 
+    if args.libcxx_used:
+        configuration.libcxx_used = args.libcxx_used
+
     if args.enabled_plugins:
         configuration.enabled_plugins = args.enabled_plugins
 
Index: lldb/packages/Python/lldbsuite/test/configuration.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/configuration.py
+++ lldb/packages/Python/lldbsuite/test/configuration.py
@@ -142,6 +142,9 @@
 # LLDB library directory.
 lldb_libs_dir = None
 
+# Whether to force use of libc++ when using liblldb.
+libcxx_used = False
+
 # A plugin whose tests will be enabled, like intel-pt.
 enabled_plugins = []
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to