[llvm] [SandboxIR] Adds BasicBlock and adds functionality to Function and Context (PR #97637)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 10:46:04 PDT 2024


================
@@ -163,6 +190,16 @@ void Function::dumpNameAndArgs(raw_ostream &OS) const {
 void Function::dump(raw_ostream &OS) const {
   dumpNameAndArgs(OS);
   OS << " {\n";
+  auto *LLVMF = cast<llvm::Function>(Val);
+  for (llvm::BasicBlock &LLVMBB : *LLVMF) {
+    auto *BB = cast_or_null<BasicBlock>(Ctx.getValue(&LLVMBB));
+    if (BB == nullptr)
+      OS << "NULL";
+    else
+      OS << *BB;
+    if (std::next(LLVMBB.getIterator()) != LLVMF->end())
----------------
aeubanks wrote:

the `interleave` functions in `STLExtras.h` might be useful here (or maybe this is fine)

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


More information about the llvm-commits mailing list