diff --git a/ast/deprecated_attr.go b/ast/deprecated_attr.go index d6aa5320e..0c4c5d05e 100644 --- a/ast/deprecated_attr.go +++ b/ast/deprecated_attr.go @@ -1,25 +1,27 @@ package ast type DeprecatedAttr struct { - Addr Address - Pos Position - Message1 string - Message2 string - ChildNodes []Node + Addr Address + Pos Position + Message1 string + Message2 string + IsInherited bool + ChildNodes []Node } func parseDeprecatedAttr(line string) *DeprecatedAttr { groups := groupsFromRegex( - `<(?P.*)> "(?P.*?)"(?P ".*?")?`, + `<(?P.*)>(?P Inherited)? "(?P.*?)"(?P ".*?")?`, line, ) return &DeprecatedAttr{ - Addr: ParseAddress(groups["address"]), - Pos: NewPositionFromString(groups["position"]), - Message1: removeQuotes(groups["message1"]), - Message2: removeQuotes(groups["message2"]), - ChildNodes: []Node{}, + Addr: ParseAddress(groups["address"]), + Pos: NewPositionFromString(groups["position"]), + Message1: removeQuotes(groups["message1"]), + Message2: removeQuotes(groups["message2"]), + IsInherited: len(groups["inherited"]) > 0, + ChildNodes: []Node{}, } } diff --git a/ast/deprecated_attr_test.go b/ast/deprecated_attr_test.go index 0e59a58ca..c6de681c9 100644 --- a/ast/deprecated_attr_test.go +++ b/ast/deprecated_attr_test.go @@ -7,11 +7,28 @@ import ( func TestDeprecatedAttr(t *testing.T) { nodes := map[string]Node{ `0x7fec4b0ab9c0 "This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead." ""`: &DeprecatedAttr{ - Addr: 0x7fec4b0ab9c0, - Pos: NewPositionFromString("line:180:48, col:63"), - Message1: "This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead.", - Message2: "", - ChildNodes: []Node{}, + Addr: 0x7fec4b0ab9c0, + Pos: NewPositionFromString("line:180:48, col:63"), + Message1: "This function is provided for compatibility reasons only. Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead.", + Message2: "", + IsInherited: false, + ChildNodes: []Node{}, + }, + `0xb75d00 "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." ""`: &DeprecatedAttr{ + Addr: 0xb75d00, + Pos: NewPositionFromString("line:1107:12"), + Message1: "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.", + Message2: "", + IsInherited: false, + ChildNodes: []Node{}, + }, + `0xb75d00 Inherited "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." ""`: &DeprecatedAttr{ + Addr: 0xb75d00, + Pos: NewPositionFromString("line:1107:12"), + Message1: "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.", + Message2: "", + IsInherited: true, + ChildNodes: []Node{}, }, }