diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -335,6 +335,9 @@ # that explicitly require no debug info. os.environ['CFLAGS'] = '-gdwarf-{}'.format(configuration.dwarf_version) + if args.custom_libcpp: + os.environ['CUSTOM_LIBCPP'] = args.custom_libcpp + if args.settings: for setting in args.settings: if not len(setting) == 1 or not setting[0].count('='): diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py --- a/lldb/packages/Python/lldbsuite/test/dotest_args.py +++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py @@ -172,6 +172,11 @@ type=str, metavar='A plugin whose tests will be enabled', help='A plugin whose tests will be enabled. The only currently supported plugin is intel-pt.') + group.add_argument( + '--custom-libcpp', + metavar='custom-libcpp', + dest='custom_libcpp', + help='(Clang only) Specify path to a custom standard library to use. Disables search for other standard C++ libraries.') # Configuration options group = parser.add_argument_group('Remote platform options') diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -402,6 +402,14 @@ endif endif +ifdef CUSTOM_LIBCPP + ifeq (,$(findstring clang,$(CC))) + $(error "CUSTOM_LIBCPP only supported for Clang compilers") + endif + + CXXFLAGS += -nostdinc++ -cxx-isystem $(CUSTOM_LIBCPP) +endif + #---------------------------------------------------------------------- # Additional system libraries #----------------------------------------------------------------------