[PATCH] D150370: Introduce StructuredData

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 03:49:08 PDT 2023


nikic added a comment.

Thanks for providing the context for this functionality. The updated patch looks good to me. I think even if we never end up introducing more uses for this, this is not going to be an undue burden, so I think it's okay to move forward with the target type use case.



================
Comment at: llvm/include/llvm/IR/StructuredData.h:18
+#include "llvm/ADT/APInt.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/StringRef.h"
----------------
DenseMap is not used.


================
Comment at: llvm/include/llvm/IR/StructuredData.h:36
+public:
+  Value() = default;
+  explicit Value(Type *T) : S(T) {}
----------------
Why do we need this class to be default-constructible? (I presume this is also why there is a monostate in the storage?)


================
Comment at: llvm/lib/AsmParser/LLParser.cpp:4213
+    LocTy ValueLoc = Lex.getLoc();
+    sdata::Value V;
+    switch (Lex.getKind()) {
----------------
Okay, I guess this is where the default initialization is used. Possibly this should be std::optional instead -- or parse the sdata value in a separate function and return it?


================
Comment at: llvm/lib/IR/StructuredData.cpp:23
+  const char *name() const noexcept override {
+    return "Structure Data Deserialize Error";
+  }
----------------
Structured


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