Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Option copied() to map Option<T&> to Option<T> #27

Merged
merged 2 commits into from
Jun 5, 2022

Conversation

danakj
Copy link
Collaborator

@danakj danakj commented Jun 5, 2022

No description provided.

danakj added 2 commits June 5, 2022 18:05
Allow replace() from T&& or const T& to avoid constructing
into the replace() function.

Add a replace_and_discard() that doesn't store and return the
value being replaced, to avoid writing `x = static_cast<X&&>(y)`
explicitly, since that will not memcpy when possible.

Avoid constructing another T() inside replace() functions, just
to assign from it.

Mark replace() functions [[nodiscard]] except for the explicit
choice to do so with replace_and_discard().
This maps by copying the pointed-to T, and requires that
T can be copied.
@danakj danakj merged commit cf18e0f into chromium:main Jun 5, 2022
@danakj danakj deleted the copied branch June 5, 2022 22:13
danakj added a commit to danakj/subspace that referenced this pull request Dec 29, 2024
This reverts commit a67c5e8.

LLVM 19 has use-after-poison errors under ASAN inside of ClangTool:

==95109==ERROR: AddressSanitizer: use-after-poison on address 0x62100000291a at pc 0x00010994cffc bp 0x00016d742690 sp 0x00016d741e40
WRITE of size 13 at 0x62100000291a thread T0
    #0 0x00010994cff8 in memcpy+0x4c0 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x50ff8)
    chromium#1 0x0001050b7f68 in llvm::StringSaver::save(llvm::Twine const&)+0xf4 (subdoc_unittests:arm64+0x1029fff68)
    chromium#2 0x000102ffc1c8 in void llvm::function_ref<void (llvm::Twine const&)>::callback_fn<clang::CompilerInvocationBase::generateCC1CommandLine(llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>) const::'lambda'(llvm::Twine const&)>(long, llvm::Twine const&)+0x2c (subdoc_unittests:arm64+0x1009441c8)
    chromium#3 0x000102fba4e4 in clang::CompilerInvocationBase::GenerateDiagnosticArgs(clang::DiagnosticOptions const&, llvm::function_ref<void (llvm::Twine const&)>, bool)+0x9d4 (subdoc_unittests:arm64+0x1009024e4)
    chromium#4 0x000102fe47b0 in clang::CompilerInvocationBase::generateCC1CommandLine(llvm::function_ref<void (llvm::Twine const&)>) const+0xe80 (subdoc_unittests:arm64+0x10092c7b0)
    chromium#5 0x000102ffd914 in void llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>::callback_fn<clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)::$_1>(long, clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)+0x64 (subdoc_unittests:arm64+0x100945914)
    chromium#6 0x000102fa0554 in RoundTrip(llvm::function_ref<bool (clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)>, llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>, clang::CompilerInvocation&, clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*, bool, bool)+0x358 (subdoc_unittests:arm64+0x1008e8554)
    chromium#7 0x000102fe07d0 in clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)+0x64 (subdoc_unittests:arm64+0x1009287d0)
    chromium#8 0x000102f5f85c in clang::tooling::ToolInvocation::run()+0x364 (subdoc_unittests:arm64+0x1008a785c)
    chromium#9 0x000102f625f8 in clang::tooling::ClangTool::run(clang::tooling::ToolAction*)+0xd40 (subdoc_unittests:arm64+0x1008aa5f8)
    chromium#10 0x000102d428a8 in subdoc::run_files(clang::tooling::CompilationDatabase const&, sus::collections::Vec<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, subdoc::RunOptions const&)+0x750 (subdoc_unittests:arm64+0x10068a8a8)
    chromium#11 0x000102d41a84 in subdoc::run_test(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, sus::collections::Slice<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, subdoc::RunOptions const&)+0x6b8 (subdoc_unittests:arm64+0x100689a84)
    chromium#12 0x00010276b63c in SubDocTest::run_code_with_options(subdoc::RunOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)+0x2ec (subdoc_unittests:arm64+0x1000b363c)
    chromium#13 0x00010276af98 in SubDocTest::run_code(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)+0x2b8 (subdoc_unittests:arm64+0x1000b2f98)
    chromium#14 0x0001027f75a0 in SubDocTest_NamespaceNested_Test::TestBody()+0x2b8 (subdoc_unittests:arm64+0x10013f5a0)
    chromium#15 0x0001092a242c in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)+0xc8 (libgtest.1.13.0.dylib:arm64+0x10a42c)
    chromium#16 0x0001091d9234 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)+0x1a0 (libgtest.1.13.0.dylib:arm64+0x41234)
    chromium#17 0x0001091d8fe0 in testing::Test::Run()+0x18c (libgtest.1.13.0.dylib:arm64+0x40fe0)
    chromium#18 0x0001091db5a4 in testing::TestInfo::Run()+0x46c (libgtest.1.13.0.dylib:arm64+0x435a4)
    chromium#19 0x0001091ddeb0 in testing::TestSuite::Run()+0x3f8 (libgtest.1.13.0.dylib:arm64+0x45eb0)
    chromium#20 0x0001091ff73c in testing::internal::UnitTestImpl::RunAllTests()+0xa60 (libgtest.1.13.0.dylib:arm64+0x6773c)
    chromium#21 0x0001092a3a2c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)+0xc8 (libgtest.1.13.0.dylib:arm64+0x10ba2c)
    chromium#22 0x0001091fe85c in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)+0x1a0 (libgtest.1.13.0.dylib:arm64+0x6685c)
    chromium#23 0x0001091fe47c in testing::UnitTest::Run()+0x244 (libgtest.1.13.0.dylib:arm64+0x6647c)
    chromium#24 0x000102ba685c in RUN_ALL_TESTS()+0xc (subdoc_unittests:arm64+0x1004ee85c)
    chromium#25 0x000102ba5bd4 in main+0x2bc (subdoc_unittests:arm64+0x1004edbd4)
    chromium#26 0x00019643f150  (<unknown module>)
    chromium#27 0xa2187ffffffffffc  (<unknown module>)

0x62100000291a is located 26 bytes inside of 4096-byte region [0x621000002900,0x621000003900)
allocated by thread T0 here:
    #0 0x00010994f944 in __sanitizer_mz_memalign+0x78 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x53944)
    chromium#1 0x0001966041bc in _malloc_zone_memalign+0x138 (libsystem_malloc.dylib:arm64+0x2c1bc)
    chromium#2 0xf071800196782cd4  (<unknown module>)
    chromium#3 0x1510000102a3830c  (<unknown module>)
    chromium#4 0x000102a38714 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::StartNewSlab()+0x4c (subdoc_unittests:arm64+0x100380714)
    chromium#5 0x000102a38070 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::AllocateSlow(unsigned long, unsigned long, llvm::Align)+0x2d0 (subdoc_unittests:arm64+0x100380070)
    chromium#6 0x0001050b7fe8 in llvm::StringSaver::save(llvm::Twine const&)+0x174 (subdoc_unittests:arm64+0x1029fffe8)
    chromium#7 0x000102ffc1c8 in void llvm::function_ref<void (llvm::Twine const&)>::callback_fn<clang::CompilerInvocationBase::generateCC1CommandLine(llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>) const::'lambda'(llvm::Twine const&)>(long, llvm::Twine const&)+0x2c (subdoc_unittests:arm64+0x1009441c8)
    chromium#8 0x000102feb5e4 in denormalizeStringImpl(llvm::function_ref<void (llvm::Twine const&)>, llvm::Twine const&, llvm::opt::Option::OptionClass, unsigned int, llvm::Twine const&)+0xb0 (subdoc_unittests:arm64+0x1009335e4)
    chromium#9 0x000102feb884 in denormalizeStringVector(llvm::function_ref<void (llvm::Twine const&)>, llvm::Twine const&, llvm::opt::Option::OptionClass, unsigned int, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&)+0x1b4 (subdoc_unittests:arm64+0x100933884)
    chromium#10 0x000102fb9d74 in clang::CompilerInvocationBase::GenerateDiagnosticArgs(clang::DiagnosticOptions const&, llvm::function_ref<void (llvm::Twine const&)>, bool)+0x264 (subdoc_unittests:arm64+0x100901d74)
    chromium#11 0x000102fe47b0 in clang::CompilerInvocationBase::generateCC1CommandLine(llvm::function_ref<void (llvm::Twine const&)>) const+0xe80 (subdoc_unittests:arm64+0x10092c7b0)
    chromium#12 0x000102ffd914 in void llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>::callback_fn<clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)::$_1>(long, clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)+0x64 (subdoc_unittests:arm64+0x100945914)
    chromium#13 0x000102fa0554 in RoundTrip(llvm::function_ref<bool (clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)>, llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>, clang::CompilerInvocation&, clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*, bool, bool)+0x358 (subdoc_unittests:arm64+0x1008e8554)
    chromium#14 0x000102fe07d0 in clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)+0x64 (subdoc_unittests:arm64+0x1009287d0)
    chromium#15 0x000102f5f85c in clang::tooling::ToolInvocation::run()+0x364 (subdoc_unittests:arm64+0x1008a785c)
    chromium#16 0x000102f625f8 in clang::tooling::ClangTool::run(clang::tooling::ToolAction*)+0xd40 (subdoc_unittests:arm64+0x1008aa5f8)
    chromium#17 0x000102d428a8 in subdoc::run_files(clang::tooling::CompilationDatabase const&, sus::collections::Vec<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, subdoc::RunOptions const&)+0x750 (subdoc_unittests:arm64+0x10068a8a8)
    chromium#18 0x000102d41a84 in subdoc::run_test(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, sus::collections::Slice<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, subdoc::RunOptions const&)+0x6b8 (subdoc_unittests:arm64+0x100689a84)

It's not immediately obvious what is wrong, maybe a bug in StringSaver.
The StringSaver itself should be on the stack still, I think.
danakj added a commit that referenced this pull request Dec 29, 2024
This reverts commit a67c5e8.

LLVM 19 has use-after-poison errors under ASAN inside of ClangTool:

==95109==ERROR: AddressSanitizer: use-after-poison on address 0x62100000291a at pc 0x00010994cffc bp 0x00016d742690 sp 0x00016d741e40
WRITE of size 13 at 0x62100000291a thread T0
    #0 0x00010994cff8 in memcpy+0x4c0 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x50ff8)
    #1 0x0001050b7f68 in llvm::StringSaver::save(llvm::Twine const&)+0xf4 (subdoc_unittests:arm64+0x1029fff68)
    #2 0x000102ffc1c8 in void llvm::function_ref<void (llvm::Twine const&)>::callback_fn<clang::CompilerInvocationBase::generateCC1CommandLine(llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>) const::'lambda'(llvm::Twine const&)>(long, llvm::Twine const&)+0x2c (subdoc_unittests:arm64+0x1009441c8)
    #3 0x000102fba4e4 in clang::CompilerInvocationBase::GenerateDiagnosticArgs(clang::DiagnosticOptions const&, llvm::function_ref<void (llvm::Twine const&)>, bool)+0x9d4 (subdoc_unittests:arm64+0x1009024e4)
    #4 0x000102fe47b0 in clang::CompilerInvocationBase::generateCC1CommandLine(llvm::function_ref<void (llvm::Twine const&)>) const+0xe80 (subdoc_unittests:arm64+0x10092c7b0)
    #5 0x000102ffd914 in void llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>::callback_fn<clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)::$_1>(long, clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)+0x64 (subdoc_unittests:arm64+0x100945914)
    #6 0x000102fa0554 in RoundTrip(llvm::function_ref<bool (clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)>, llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>, clang::CompilerInvocation&, clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*, bool, bool)+0x358 (subdoc_unittests:arm64+0x1008e8554)
    #7 0x000102fe07d0 in clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)+0x64 (subdoc_unittests:arm64+0x1009287d0)
    #8 0x000102f5f85c in clang::tooling::ToolInvocation::run()+0x364 (subdoc_unittests:arm64+0x1008a785c)
    #9 0x000102f625f8 in clang::tooling::ClangTool::run(clang::tooling::ToolAction*)+0xd40 (subdoc_unittests:arm64+0x1008aa5f8)
    #10 0x000102d428a8 in subdoc::run_files(clang::tooling::CompilationDatabase const&, sus::collections::Vec<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, subdoc::RunOptions const&)+0x750 (subdoc_unittests:arm64+0x10068a8a8)
    #11 0x000102d41a84 in subdoc::run_test(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, sus::collections::Slice<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, subdoc::RunOptions const&)+0x6b8 (subdoc_unittests:arm64+0x100689a84)
    #12 0x00010276b63c in SubDocTest::run_code_with_options(subdoc::RunOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)+0x2ec (subdoc_unittests:arm64+0x1000b363c)
    #13 0x00010276af98 in SubDocTest::run_code(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)+0x2b8 (subdoc_unittests:arm64+0x1000b2f98)
    #14 0x0001027f75a0 in SubDocTest_NamespaceNested_Test::TestBody()+0x2b8 (subdoc_unittests:arm64+0x10013f5a0)
    #15 0x0001092a242c in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)+0xc8 (libgtest.1.13.0.dylib:arm64+0x10a42c)
    #16 0x0001091d9234 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)+0x1a0 (libgtest.1.13.0.dylib:arm64+0x41234)
    #17 0x0001091d8fe0 in testing::Test::Run()+0x18c (libgtest.1.13.0.dylib:arm64+0x40fe0)
    #18 0x0001091db5a4 in testing::TestInfo::Run()+0x46c (libgtest.1.13.0.dylib:arm64+0x435a4)
    #19 0x0001091ddeb0 in testing::TestSuite::Run()+0x3f8 (libgtest.1.13.0.dylib:arm64+0x45eb0)
    #20 0x0001091ff73c in testing::internal::UnitTestImpl::RunAllTests()+0xa60 (libgtest.1.13.0.dylib:arm64+0x6773c)
    #21 0x0001092a3a2c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)+0xc8 (libgtest.1.13.0.dylib:arm64+0x10ba2c)
    #22 0x0001091fe85c in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)+0x1a0 (libgtest.1.13.0.dylib:arm64+0x6685c)
    #23 0x0001091fe47c in testing::UnitTest::Run()+0x244 (libgtest.1.13.0.dylib:arm64+0x6647c)
    #24 0x000102ba685c in RUN_ALL_TESTS()+0xc (subdoc_unittests:arm64+0x1004ee85c)
    #25 0x000102ba5bd4 in main+0x2bc (subdoc_unittests:arm64+0x1004edbd4)
    #26 0x00019643f150  (<unknown module>)
    #27 0xa2187ffffffffffc  (<unknown module>)

0x62100000291a is located 26 bytes inside of 4096-byte region [0x621000002900,0x621000003900)
allocated by thread T0 here:
    #0 0x00010994f944 in __sanitizer_mz_memalign+0x78 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x53944)
    #1 0x0001966041bc in _malloc_zone_memalign+0x138 (libsystem_malloc.dylib:arm64+0x2c1bc)
    #2 0xf071800196782cd4  (<unknown module>)
    #3 0x1510000102a3830c  (<unknown module>)
    #4 0x000102a38714 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::StartNewSlab()+0x4c (subdoc_unittests:arm64+0x100380714)
    #5 0x000102a38070 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::AllocateSlow(unsigned long, unsigned long, llvm::Align)+0x2d0 (subdoc_unittests:arm64+0x100380070)
    #6 0x0001050b7fe8 in llvm::StringSaver::save(llvm::Twine const&)+0x174 (subdoc_unittests:arm64+0x1029fffe8)
    #7 0x000102ffc1c8 in void llvm::function_ref<void (llvm::Twine const&)>::callback_fn<clang::CompilerInvocationBase::generateCC1CommandLine(llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>) const::'lambda'(llvm::Twine const&)>(long, llvm::Twine const&)+0x2c (subdoc_unittests:arm64+0x1009441c8)
    #8 0x000102feb5e4 in denormalizeStringImpl(llvm::function_ref<void (llvm::Twine const&)>, llvm::Twine const&, llvm::opt::Option::OptionClass, unsigned int, llvm::Twine const&)+0xb0 (subdoc_unittests:arm64+0x1009335e4)
    #9 0x000102feb884 in denormalizeStringVector(llvm::function_ref<void (llvm::Twine const&)>, llvm::Twine const&, llvm::opt::Option::OptionClass, unsigned int, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&)+0x1b4 (subdoc_unittests:arm64+0x100933884)
    #10 0x000102fb9d74 in clang::CompilerInvocationBase::GenerateDiagnosticArgs(clang::DiagnosticOptions const&, llvm::function_ref<void (llvm::Twine const&)>, bool)+0x264 (subdoc_unittests:arm64+0x100901d74)
    #11 0x000102fe47b0 in clang::CompilerInvocationBase::generateCC1CommandLine(llvm::function_ref<void (llvm::Twine const&)>) const+0xe80 (subdoc_unittests:arm64+0x10092c7b0)
    #12 0x000102ffd914 in void llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>::callback_fn<clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)::$_1>(long, clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)+0x64 (subdoc_unittests:arm64+0x100945914)
    #13 0x000102fa0554 in RoundTrip(llvm::function_ref<bool (clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)>, llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>, clang::CompilerInvocation&, clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*, bool, bool)+0x358 (subdoc_unittests:arm64+0x1008e8554)
    #14 0x000102fe07d0 in clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)+0x64 (subdoc_unittests:arm64+0x1009287d0)
    #15 0x000102f5f85c in clang::tooling::ToolInvocation::run()+0x364 (subdoc_unittests:arm64+0x1008a785c)
    #16 0x000102f625f8 in clang::tooling::ClangTool::run(clang::tooling::ToolAction*)+0xd40 (subdoc_unittests:arm64+0x1008aa5f8)
    #17 0x000102d428a8 in subdoc::run_files(clang::tooling::CompilationDatabase const&, sus::collections::Vec<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, subdoc::RunOptions const&)+0x750 (subdoc_unittests:arm64+0x10068a8a8)
    #18 0x000102d41a84 in subdoc::run_test(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, sus::collections::Slice<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, subdoc::RunOptions const&)+0x6b8 (subdoc_unittests:arm64+0x100689a84)

It's not immediately obvious what is wrong, maybe a bug in StringSaver.
The StringSaver itself should be on the stack still, I think.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant