| 440 | } |
| 441 | |
| 442 | bool MoreRestrictive(const OpDef::AttrDef& old_attr, |
| 443 | const OpDef::AttrDef& new_attr) { |
| 444 | // Anything -> no restriction : not more restrictive. |
| 445 | if (!new_attr.has_allowed_values()) return false; |
| 446 | // No restriction -> restriction : more restrictive. |
| 447 | if (!old_attr.has_allowed_values()) return true; |
| 448 | // If anything that was previously allowed is no longer allowed: |
| 449 | // more restrictive. |
| 450 | if (!IsSubsetOf(old_attr.allowed_values().list().type(), |
| 451 | new_attr.allowed_values().list().type())) { |
| 452 | return true; |
| 453 | } |
| 454 | if (!IsSubsetOf(old_attr.allowed_values().list().s(), |
| 455 | new_attr.allowed_values().list().s())) { |
| 456 | return true; |
| 457 | } |
| 458 | return false; |
| 459 | } |
| 460 | |
| 461 | string AllowedStr(const OpDef::AttrDef& attr) { |
| 462 | if (!attr.has_allowed_values()) return "no restriction"; |
no test coverage detected