Skip to content

Commit 3200d64

Browse files
authored
[clang][ssaf] Fix nondeterministic test failures of clang/test/Analysis/Scalable/call-graph.cpp (llvm#190155)
fixup! [clang][ssaf] Implement JSON format for CallGraph summary The order of checks were unspecified in the test. Consequently, "polymorphic" may have appeared before "caller" failing the test. This patch splits the test into separate files so these wouldn't interfere. Example bot failures: https://lab.llvm.org/buildbot/#/builders/225/builds/4974 https://lab.llvm.org/buildbot/#/builders/144/builds/50732 https://lab.llvm.org/buildbot/#/builders/190/builds/39773 https://lab.llvm.org/buildbot/#/builders/46/builds/33213 Fixes up llvm#189681
1 parent 329af7d commit 3200d64

1 file changed

Lines changed: 32 additions & 27 deletions

File tree

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,45 @@
1-
// RUN: rm -rf %t.summary.json
2-
// RUN: %clang_cc1 -fsyntax-only %s \
1+
// RUN: rm -rf %t
2+
// RUN: mkdir -p %t
3+
// RUN: split-file %s %t
4+
5+
// RUN: %clang_cc1 -fsyntax-only %t/caller.cpp \
36
// RUN: --ssaf-extract-summaries=CallGraph \
4-
// RUN: --ssaf-tu-summary-file=%t.summary.json
5-
// RUN: FileCheck %s --match-full-lines --input-file=%t.summary.json
7+
// RUN: --ssaf-tu-summary-file=%t/caller.summary.json
8+
// RUN: FileCheck --match-full-lines --check-prefix=CALLER %t/caller.cpp --input-file=%t/caller.summary.json
69

7-
// caller() has a direct callee and no virtual callees.
8-
// CHECK-LABEL: "entity_summary": {
9-
// CHECK-DAG: "def": {
10-
// CHECK-DAG: "col": {{[0-9]+}},
11-
// CHECK-DAG: "file": "{{.+}}",
12-
// CHECK-DAG: "line": {{[0-9]+}}
13-
// CHECK-DAG: "pretty_name": "caller()",
14-
// CHECK-DAG: "direct_callees": [
15-
// CHECK-DAG: "virtual_callees": []
10+
// RUN: %clang_cc1 -fsyntax-only %t/polymorphic.cpp \
11+
// RUN: --ssaf-extract-summaries=CallGraph \
12+
// RUN: --ssaf-tu-summary-file=%t/polymorphic.summary.json
13+
// RUN: FileCheck --match-full-lines --check-prefix=POLYMORPHIC %t/polymorphic.cpp --input-file=%t/polymorphic.summary.json
1614

15+
//--- caller.cpp
1716
// polymorphic() has a virtual callee and no direct callees.
18-
// CHECK-LABEL: "entity_summary": {
19-
// CHECK-DAG: "def": {
20-
// CHECK-DAG: "col": {{[0-9]+}},
21-
// CHECK-DAG: "file": "{{.+}}",
22-
// CHECK-DAG: "line": {{[0-9]+}}
23-
// CHECK-DAG: "pretty_name": "polymorphic(Base &)",
24-
// CHECK-DAG: "direct_callees": [],
25-
// CHECK-DAG: "virtual_callees": [
17+
// CALLER-DAG: "def": {
18+
// CALLER-DAG: "col": {{[0-9]+}},
19+
// CALLER-DAG: "file": "{{.+}}",
20+
// CALLER-DAG: "line": {{[0-9]+}}
21+
// CALLER-DAG: "pretty_name": "caller()",
22+
// CALLER-DAG: "direct_callees": [
23+
// CALLER-DAG: "virtual_callees": []
24+
void callee();
25+
void caller() {
26+
callee();
27+
}
2628

29+
//--- polymorphic.cpp
30+
// polymorphic() has a virtual callee and no direct callees.
31+
// POLYMORPHIC-DAG: "def": {
32+
// POLYMORPHIC-DAG: "col": {{[0-9]+}},
33+
// POLYMORPHIC-DAG: "file": "{{.+}}",
34+
// POLYMORPHIC-DAG: "line": {{[0-9]+}}
35+
// POLYMORPHIC-DAG: "pretty_name": "polymorphic(Base &)",
36+
// POLYMORPHIC-DAG: "direct_callees": [],
37+
// POLYMORPHIC-DAG: "virtual_callees": [
2738
struct Base {
2839
virtual ~Base();
2940
virtual void vmethod();
3041
};
3142

32-
void callee();
33-
34-
void caller() {
35-
callee();
36-
}
37-
3843
void polymorphic(Base &b) {
3944
b.vmethod();
4045
}

0 commit comments

Comments
 (0)