Returns string attribute value for the node if the attribute is present, otherwise returns empty optional value.
| 38 | // Returns string attribute value for the node if the attribute is present, |
| 39 | // otherwise returns empty optional value. |
| 40 | absl::optional<string> GetStringAttr(const Node& n, const string& attr_name) { |
| 41 | auto attr = n.attrs().Find(attr_name); |
| 42 | if (!attr) { |
| 43 | return absl::nullopt; |
| 44 | } else { |
| 45 | return attr->s(); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // Adds a value to the node's list attribute. |
| 50 | template <typename T> |
no test coverage detected