[PATCH] D20183: Enhance CodeView record deserialization with some template metaprogramming

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Wed May 11 17:37:45 PDT 2016


zturner added inline comments.

================
Comment at: include/llvm/DebugInfo/CodeView/RecordSerialization.h:54-58
@@ +53,7 @@
+
+/// Decode a numeric leaf value that is known to be a uint32_t.
+std::error_code consume(ArrayRef<uint8_t> &Data, uint64_t &Num);
+
+/// Decodes signed and unsigned fixed-length integers.
+std::error_code consume(ArrayRef<uint8_t> &Data, uint32_t &Item);
+std::error_code consume(StringRef &Data, uint32_t &Item);
----------------
rnk wrote:
> Seems kind of awkward that uint64_t is a leaf numeric, but uint32_t is fixed length.
Yea, I thought of this too, but I'm not sure what a good solution is.  Could make another macro like `LEAF_64_FIELD` and use a similar pattern to the other ones to select a different overload.

================
Comment at: include/llvm/DebugInfo/CodeView/RecordSerialization.h:141
@@ +140,3 @@
+// earlier.
+#define CONDITIONAL_FIELD(I, C)                                                \
+  serialize_conditional(I, [&]() { return !!(C); })
----------------
rnk wrote:
> These macros have fairly generic names. We can prefix them with LLVM_, or we could hide them in TypeRecord.cpp along with all the deserialize method implementations.
Rather prefix with `CV_` than `LLVM_`, since at least that indicates what they're used for.


http://reviews.llvm.org/D20183





More information about the llvm-commits mailing list