================
@@ -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));
----------------
evelez7 wrote:

The add functions passed here don't return any errors. They follow the pattern 
where an invalid Info will call the specialization that just exits. The add 
functions for types do return the errors.

I think we mentioned that in our last meeting. When the inconsistency is fixed 
we can just have the one `handleSubBlock` function.

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

Reply via email to