IR: Allow MDSubrange to have 'count: -1'

It turns out that `count: -1` is a special value indicating an empty
array, such as `Values` in:

    struct T {
      unsigned Count;
      int Values[];
    };

Handle it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229769 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-02-18 23:17:51 +00:00
parent f89d9b1c75
commit c2c5e48ad5
4 changed files with 28 additions and 3 deletions

View File

@ -3276,7 +3276,7 @@ bool LLParser::ParseGenericDebugNode(MDNode *&Result, bool IsDistinct) {
/// ::= !MDSubrange(count: 30, lowerBound: 2)
bool LLParser::ParseMDSubrange(MDNode *&Result, bool IsDistinct) {
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
REQUIRED(count, MDUnsignedField, (0, UINT64_MAX >> 1)); \
REQUIRED(count, MDSignedField, (-1, -1, INT64_MAX)); \
OPTIONAL(lowerBound, MDSignedField, );
PARSE_MD_FIELDS();
#undef VISIT_MD_FIELDS