diff --git a/ast/warn_unused_result_attr.go b/ast/warn_unused_result_attr.go index 8ea63b1cf..7a46b295e 100644 --- a/ast/warn_unused_result_attr.go +++ b/ast/warn_unused_result_attr.go @@ -5,15 +5,17 @@ package ast type WarnUnusedResultAttr struct { Addr Address Pos Position + Inherited bool ChildNodes []Node } func parseWarnUnusedResultAttr(line string) *WarnUnusedResultAttr { - groups := groupsFromRegex(`<(?P.*)>( warn_unused_result)?`, line) + groups := groupsFromRegex(`<(?P.*)>(?P Inherited)?( warn_unused_result)?`, line) return &WarnUnusedResultAttr{ Addr: ParseAddress(groups["address"]), Pos: NewPositionFromString(groups["position"]), + Inherited: len(groups["inherited"]) > 0, ChildNodes: []Node{}, } } diff --git a/ast/warn_unused_result_attr_test.go b/ast/warn_unused_result_attr_test.go index e155f127b..30f8a8a2b 100644 --- a/ast/warn_unused_result_attr_test.go +++ b/ast/warn_unused_result_attr_test.go @@ -9,11 +9,19 @@ func TestWarnUnusedResultAttr(t *testing.T) { `0x7fa1d704d420 warn_unused_result`: &WarnUnusedResultAttr{ Addr: 0x7fa1d704d420, Pos: NewPositionFromString("col:60"), + Inherited: false, ChildNodes: []Node{}, }, `0x1fac810 `: &WarnUnusedResultAttr{ Addr: 0x1fac810, Pos: NewPositionFromString("line:481:52"), + Inherited: false, + ChildNodes: []Node{}, + }, + `0x3794590 Inherited`: &WarnUnusedResultAttr{ + Addr: 0x3794590, + Pos: NewPositionFromString("/home/kph/co/util-linux/libblkid/src/blkidP.h:374:19"), + Inherited: true, ChildNodes: []Node{}, }, }