GaloisInc / llvm-pretty

An llvm pretty printer inspired by the haskell llvm binding
Other
28 stars 15 forks source link

Add tag field to METADATA_TEMPLATE_VALUE #43

Closed langston-barrett closed 5 years ago

langston-barrett commented 5 years ago

This type only has three fields: https://github.com/elliottt/llvm-pretty/blob/master/src/Text/LLVM/AST.hs#L1096. It is supposed to have four: https://github.com/llvm-mirror/llvm/blob/a3fa104c8c41ae015b8d4c677bc7fc5b88957fe1/lib/Bitcode/Reader/BitcodeReader.cpp#L1517

There is no associated commit ID, it looks like it always had the tag field.

Tag

langston-barrett commented 5 years ago

Okay, this particular node has an especially twisted history.

  1. Feb 12, 2015: MDTemplateTypeParameter lands. It's fields have type i. Num ii. Maybe PValMd iii. MDString iv. Maybe PValMd v. Maybe PValMd
  2. Feb 18, 2015: The last field, "scope", was dropped, and the type of the second field was made into a MDString.
  3. Apr 23, 2016: Removal of MDString-based references (see #39). Third field is made into a DITypeRef.

Interestingly, at no point in this process does the field only have three fields, as it does in the AST.

The biggest flaw I'm seeing is that the first field of the record is not a reference, but it is looked up as if it is one. This is causing the parser to crash, because the reference is not defined.