[PATCH] D150370: Introduce StructuredData

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 13:24:01 PDT 2023


nhaehnle added a comment.

In D150370#4440349 <https://reviews.llvm.org/D150370#4440349>, @arsenm wrote:

> Missing all the assembler tests (but I guess they come with the bitcode parts?)

Yeah, the assembler tests are with the actual use cases of this infrastructure in the next patch.



================
Comment at: llvm/include/llvm/IR/StructuredData.h:70
+  Type *getType() const {
+    assert(isType());
+    return std::get<Type *>(S);
----------------
arsenm wrote:
> Does std::get on variant not do this for you?
std::get throws on error and we disable exceptions in LLVM. I'm not sure what that means in practice so thought it safest to add the assertion.


================
Comment at: llvm/lib/IR/AsmWriter.cpp:1345
+    } else {
+      llvm_unreachable("unhandled sdata::Value type");
+    }
----------------
arsenm wrote:
> seems more like a report_fatal_error kind of case
Really? I thought report_fatal_error was primarily for states that can be reached by bad input. This state here cannot be reached by bad input, but only by somebody extending sdata::Value and then forgetting to change this code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150370/new/

https://reviews.llvm.org/D150370



More information about the llvm-commits mailing list