================ @@ -800,11 +800,37 @@ llvm::Error ClangDocBitcodeReader::readBlock(unsigned ID, T I) { } } -// TODO: Create a helper that can receive a function to reduce repetition for -// most blocks. +template <typename InfoType, typename T, typename Callback> +llvm::Error ClangDocBitcodeReader::handleSubBlock(unsigned ID, T Parent, + Callback Function) { + InfoType Info; + if (auto Err = readBlock(ID, &Info)) + return Err; + Function(Parent, std::move(Info)); ---------------- ilovepi wrote:
Why not check the error here? wondering since you seem to do it in handlTypeSubBlock(), and I don't see why you need one check and not the other... https://github.com/llvm/llvm-project/pull/145835 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits