[clang-tools-extra] [clang-doc] refactor BitcodeReader::readSubBlock (PR #145835)
Paul Kirth via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 26 12:07:36 PDT 2025
================
@@ -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
More information about the cfe-commits
mailing list