-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev/KP-18636' into 'master'
KP detector for 18636 See merge request eng/libadalang/langkit-query-language!76
- Loading branch information
Showing
6 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Flag 'Image applied to objects of a class-wide interface type | ||
|
||
@check(message="possible occurrence of KP 18636", impact="22.*,23.*") | ||
fun kp_18636(node) = | ||
node is AttributeRef | ||
when node.f_attribute.p_name_is("Image") | ||
and node.f_prefix is Name( | ||
p_referenced_decl() is ObjectDecl or ParamSpec or GenericFormalObjDecl, | ||
p_expression_type() is ClasswideTypeDecl( | ||
p_is_interface_type() is true)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package body P is | ||
|
||
procedure Proc (Object : One'Class) is | ||
S : constant String := Object'Image; -- FLAG | ||
begin | ||
null; | ||
end Proc; | ||
|
||
end P; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package P is | ||
|
||
type Root is interface; | ||
type One is interface and Root; | ||
|
||
procedure Proc (Object : One'Class); | ||
|
||
end P; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
project Prj is | ||
end Prj; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
p.adb:4:30: rule violation: possible occurrence of KP 18636 | ||
4 | S : constant String := Object'Image; -- FLAG | ||
| ^^^^^^^^^^^^ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
driver: 'checker' | ||
rule_name: KP_18636 | ||
project: 'prj.gpr' |