[clang-tools-extra] [clang-doc] refactor BitcodeReader::readSubBlock (PR #145835)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 26 13:34:18 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:

oh, right. Thanks for reminding me. yeah, seems fine then. maybe leave a TODO so we don't forget?

https://github.com/llvm/llvm-project/pull/145835


More information about the cfe-commits mailing list