199451b44SJordan Rupprecht""" 299451b44SJordan RupprechtTest calling std::String member functions. 399451b44SJordan Rupprecht""" 499451b44SJordan Rupprecht 599451b44SJordan Rupprechtimport lldb 699451b44SJordan Rupprechtfrom lldbsuite.test.decorators import * 799451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import * 899451b44SJordan Rupprechtfrom lldbsuite.test import lldbutil 999451b44SJordan Rupprecht 1099451b44SJordan Rupprecht 11*2238dcc3SJonas Devlieghereclass ExprCommandCallFunctionTestCase(TestBase): 1299451b44SJordan Rupprecht @expectedFailureAll( 13*2238dcc3SJonas Devlieghere compiler="icc", bugnumber="llvm.org/pr14437, fails with ICC 13.1" 14*2238dcc3SJonas Devlieghere ) 1599451b44SJordan Rupprecht @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765") 16*2238dcc3SJonas Devlieghere @skipIf(compiler="clang", compiler_version=["<", "9.0"]) 1799451b44SJordan Rupprecht def test_with(self): 1899451b44SJordan Rupprecht """Test calling std::String member function.""" 1999451b44SJordan Rupprecht self.build() 20*2238dcc3SJonas Devlieghere lldbutil.run_to_source_breakpoint( 21*2238dcc3SJonas Devlieghere self, "// break here", lldb.SBFileSpec("main.cpp") 22*2238dcc3SJonas Devlieghere ) 2399451b44SJordan Rupprecht 24*2238dcc3SJonas Devlieghere self.expect("expression str", substrs=["Hello world"]) 2599451b44SJordan Rupprecht 2699451b44SJordan Rupprecht # Calling this function now succeeds, but we follow the typedef return type through to 2799451b44SJordan Rupprecht # const char *, and thus don't invoke the Summary formatter. 2899451b44SJordan Rupprecht 2999451b44SJordan Rupprecht # clang's libstdc++ on ios arm64 inlines std::string::c_str() always; 3099451b44SJordan Rupprecht # skip this part of the test. 3199451b44SJordan Rupprecht triple = self.dbg.GetSelectedPlatform().GetTriple() 3299451b44SJordan Rupprecht do_cstr_test = True 33*2238dcc3SJonas Devlieghere if triple in [ 34*2238dcc3SJonas Devlieghere "arm64-apple-ios", 35*2238dcc3SJonas Devlieghere "arm64e-apple-ios", 36*2238dcc3SJonas Devlieghere "arm64-apple-tvos", 37*2238dcc3SJonas Devlieghere "armv7k-apple-watchos", 38*2238dcc3SJonas Devlieghere "arm64-apple-bridgeos", 39*2238dcc3SJonas Devlieghere "arm64_32-apple-watchos", 40*2238dcc3SJonas Devlieghere ]: 4199451b44SJordan Rupprecht do_cstr_test = False 4299451b44SJordan Rupprecht if do_cstr_test: 43*2238dcc3SJonas Devlieghere self.expect("expression str.c_str()", substrs=["Hello world"]) 44