This change checks for the case where people want to erase a string to the end, i.e., __n == npos, and inlines the call if so.
This also demonstrates keeping the ABI intact for V1, but inlining the erase() method for unstable.
Differential D73743
Inline basic_string::erase for fastpath where __n == npos mvels on Jan 30 2020, 1:43 PM. Authored by
Details This change checks for the case where people want to erase a string to the end, i.e., __n == npos, and inlines the call if so. This also demonstrates keeping the ABI intact for V1, but inlining the erase() method for unstable.
Diff Detail
Event TimelineComment Actions You'll need to update the ABI lists for the unstable ABI to account for the addition of __erase_external. Try running ninja check-cxx-abilist. Lurkers: Martijn and I spoke at length and we decided to try and have two fully separate lists of exported symbols for the stable and unstable ABIs. We think this will make it clearer what's exported in what configuration, etc. In particular, I didn't like the fact that in the stable ABI this patch started exporting __erase_external even though it would never actually be used from the dylib (cause otherwise it's an ABI break for back-deployment). Martijn nicely agreed to prototype a patch that splits the two lists out, and we'll see which way we go based on that patch.
Comment Actions The external template list changes (split into explicit V1 and UNSTABLE versions) are in https://reviews.llvm.org/D74870 I'll rebase this change on that one (assuming arc phabricator figures out me doing so)
Comment Actions Is there a way I can easily tell phabricator that this is baselined against https://reviews.llvm.org/D74870 ? I admit I don't understand phabricator well, or the mysterious ways it works. On my local repo I rebased my branch, which works like a charm as that is ..... basic git. I also figured setting 'parent revision' would establish this (not so much). Should I RTFM? :) Comment Actions Try arc diff HEAD^. We should just adjust the .arcconfig for LLVM to do this automatically ... I'll put up a patch. Comment Actions Inline basic_string::erase for fastpath where __n == npos Some renames, rediffed on existing ABI lists Comment Actions Hi, I believe this patch is causing the following undefined symbol error we're seeing in our 2 stage mac builders: [367/3568] Linking CXX executable bin/llvm-tblgen FAILED: bin/llvm-tblgen : && /b/s/w/ir/k/recipe_cleanup/clangINjhKi/llvm_build_dir/./bin/clang++ -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -flto -fdebug-prefix-map=/b/s/w/ir/k/recipe_cleanup/clangINjhKi/llvm_build_dir/tools/clang/stage2-bins=../recipe_cleanup/clangINjhKi/llvm_build_dir/tools/clang/stage2-bins -fdebug-prefix-map=/b/s/w/ir/k/llvm-project/= -no-canonical-prefixes -O3 -DNDEBUG -Wl,-search_paths_first -Wl,-headerpad_max_install_names -nostdlib++ /b/s/w/ir/k/cipd/lib/libc++.a -flto -Wl,-lto_library -Wl,/b/s/w/ir/k/recipe_cleanup/clangINjhKi/llvm_build_dir/./lib/libLTO.dylib -Wl,-dead_strip utils/TableGen/CMakeFiles/llvm-tblgen.dir/AsmMatcherEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/AsmWriterEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/AsmWriterInst.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/Attributes.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CallingConvEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeEmitterGen.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenDAGPatterns.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenHwModes.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenInstruction.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenMapTable.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenRegisters.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenSchedule.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenTarget.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcherEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcherGen.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcherOpt.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DAGISelMatcher.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DFAEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DFAPacketizerEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/DisassemblerEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/ExegesisEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/FastISelEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/FixedLenDecoderEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/GICombinerEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/GlobalISelEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/InfoByHwMode.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/InstrInfoEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/InstrDocsEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/IntrinsicEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/OptEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/OptParserEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/OptRSTEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/PredicateExpander.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/PseudoLoweringEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/RISCVCompressInstEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/RegisterBankEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/RegisterInfoEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/SDNodeProperties.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/SearchableTableEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/SubtargetEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/SubtargetFeatureInfo.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/TableGen.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/Types.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86DisassemblerTables.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86EVEX2VEXTablesEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86FoldTablesEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86ModRMFilters.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/X86RecognizableInstr.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/WebAssemblyDisassemblerEmitter.cpp.o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CTagsEmitter.cpp.o -o bin/llvm-tblgen -Wl,-rpath,@loader_path/../lib lib/libLLVMSupport.a lib/libLLVMTableGen.a lib/libLLVMTableGenGlobalISel.a lib/libLLVMSupport.a /usr/lib/libz.dylib -lm lib/libLLVMDemangle.a && : Undefined symbols for architecture x86_64: "std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char> >::__erase_external_with_move(unsigned long, unsigned long)", referenced from: (anonymous namespace)::AsmWriterEmitter::EmitPrintInstruction(llvm::raw_ostream&) in lto.o UnescapeString(std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char> >&) in lto.o ld: symbol(s) not found for architecture x86_64 clang++: error: linker command failed with exit code 1 (use -v to see invocation) Could you take a look and send out a fix or revert? Thanks. Builder: https://luci-milo.appspot.com/p/fuchsia/builders/prod/clang-mac-x64/b8887357725525428704 |
Nit: I was fond of using external to denote that a function was designed as such.