Skip to content

Commit 32d7df2

Browse files
committed
Merge branch 'topic/422' into 'master'
lkql: improve ways errors messages are transmitted to the checker See merge request eng/libadalang/langkit-query-language!383
2 parents 40f2fa9 + 2b202bc commit 32d7df2

File tree

6 files changed

+57
-5
lines changed

6 files changed

+57
-5
lines changed

lkql_jit/cli/src/main/java/com/adacore/lkql_jit/cli/GNATCheckWorker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ protected int executeScript(Context.Builder contextBuilder) {
223223
try {
224224
optionsBuilder.files(Files.readAllLines(Paths.get(this.args.filesFrom)));
225225
} catch (IOException e) {
226-
System.err.println("Could not read file: " + this.args.filesFrom);
226+
System.err.println("WORKER_ERROR: Could not read file: " + this.args.filesFrom);
227227
}
228228
}
229229

lkql_jit/language/src/main/java/com/adacore/lkql_jit/checker/built_ins/NodeCheckerFunction.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,13 @@ public Object executeGeneric(VirtualFrame frame) {
130130
visitList.addFirst(new VisitStep(stubBody, true, inSparkCode));
131131
}
132132
} catch (Libadalang.LangkitException e) {
133-
context.println(
134-
StringUtils.concat(
135-
"Error during generic instantiation walking: ",
136-
e.getMessage()));
133+
context.getDiagnosticEmitter()
134+
.emitDiagnostic(
135+
CheckerUtils.MessageKind.ERROR,
136+
e.getMessage(),
137+
new LalLocationWrapper(currentNode, context.linesCache),
138+
new SourceSectionWrapper(this.callNode.getSourceSection()),
139+
rootUnit.getFileName(true));
137140
continue;
138141
}
139142

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
project Test is
2+
3+
end Test;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
procedure Test is
2+
package I is new PP (4);
3+
begin
4+
null;
5+
end;
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Total gnatcheck failures: 1
2+
1. Summary
3+
4+
fully compliant sources : 0
5+
sources with exempted violations only : 0
6+
sources with non-exempted violations : 0
7+
unverified sources : 1
8+
total sources : 1
9+
ignored sources : 0
10+
11+
non-exempted violations : 0
12+
rule exemption warnings : 0
13+
compilation errors : 0
14+
exempted violations : 0
15+
internal errors : 1
16+
17+
2. Exempted Coding Standard Violations
18+
19+
no exempted violations detected
20+
21+
3. Non-exempted Coding Standard Violations
22+
23+
no non-exempted violations detected
24+
25+
4. Rule exemption problems
26+
27+
no rule exemption problems detected
28+
29+
5. Language violations
30+
31+
no language violations detected
32+
33+
6. Gnatcheck internal errors
34+
35+
test.adb:2:04: error: internal issue at checker.lkql:4:22: test.adb:2:4-2:28: dereferencing a null access [/test.adb]
36+
37+
>>>program returned status code 2
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
driver: gnatcheck
2+
project: prj.gpr
3+
rules:
4+
- +Rderiving_from_predefined_type

0 commit comments

Comments
 (0)