martong updated this revision to Diff 328149.
martong added a comment.
Herald added a reviewer: Szelethus.
Add a test case which fails if lit --vg is used.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97849/new/
https://reviews.llvm.org/D97849
Files:
clang/include/clang/AST/Stmt.h
clang/test/Analysis/Inputs/ctu-other.c
clang/test/Analysis/Inputs/ctu-other.c.externalDefMap.ast-dump.txt
clang/test/Analysis/ctu-main.c
Index: clang/test/Analysis/ctu-main.c
===================================================================
--- clang/test/Analysis/ctu-main.c
+++ clang/test/Analysis/ctu-main.c
@@ -69,3 +69,8 @@
d.b = 0;
clang_analyzer_eval(structInProto(&d) == 0); // expected-warning{{TRUE}}
expected-warning{{FALSE}}
}
+
+int switchWithoutCases(int);
+void testSwitchStmtCrash(int x) {
+ switchWithoutCases(x);
+}
Index: clang/test/Analysis/Inputs/ctu-other.c.externalDefMap.ast-dump.txt
===================================================================
--- clang/test/Analysis/Inputs/ctu-other.c.externalDefMap.ast-dump.txt
+++ clang/test/Analysis/Inputs/ctu-other.c.externalDefMap.ast-dump.txt
@@ -4,3 +4,4 @@
c:@F@enumCheck ctu-other.c.ast
c:@F@identImplicit ctu-other.c.ast
c:@F@structInProto ctu-other.c.ast
+c:@F@switchWithoutCases ctu-other.c.ast
Index: clang/test/Analysis/Inputs/ctu-other.c
===================================================================
--- clang/test/Analysis/Inputs/ctu-other.c
+++ clang/test/Analysis/Inputs/ctu-other.c
@@ -49,3 +49,9 @@
int structInProto(struct DataType {int a;int b; } * d) {
return 0;
}
+
+int switchWithoutCases(int x) {
+ switch (x) {
+ };
+ return 0;
+}
Index: clang/include/clang/AST/Stmt.h
===================================================================
--- clang/include/clang/AST/Stmt.h
+++ clang/include/clang/AST/Stmt.h
@@ -2119,7 +2119,7 @@
friend TrailingObjects;
/// Points to a linked list of case and default statements.
- SwitchCase *FirstCase;
+ SwitchCase *FirstCase = nullptr;
// SwitchStmt is followed by several trailing objects,
// some of which optional. Note that it would be more convenient to
Index: clang/test/Analysis/ctu-main.c
===================================================================
--- clang/test/Analysis/ctu-main.c
+++ clang/test/Analysis/ctu-main.c
@@ -69,3 +69,8 @@
d.b = 0;
clang_analyzer_eval(structInProto(&d) == 0); // expected-warning{{TRUE}} expected-warning{{FALSE}}
}
+
+int switchWithoutCases(int);
+void testSwitchStmtCrash(int x) {
+ switchWithoutCases(x);
+}
Index: clang/test/Analysis/Inputs/ctu-other.c.externalDefMap.ast-dump.txt
===================================================================
--- clang/test/Analysis/Inputs/ctu-other.c.externalDefMap.ast-dump.txt
+++ clang/test/Analysis/Inputs/ctu-other.c.externalDefMap.ast-dump.txt
@@ -4,3 +4,4 @@
c:@F@enumCheck ctu-other.c.ast
c:@F@identImplicit ctu-other.c.ast
c:@F@structInProto ctu-other.c.ast
+c:@F@switchWithoutCases ctu-other.c.ast
Index: clang/test/Analysis/Inputs/ctu-other.c
===================================================================
--- clang/test/Analysis/Inputs/ctu-other.c
+++ clang/test/Analysis/Inputs/ctu-other.c
@@ -49,3 +49,9 @@
int structInProto(struct DataType {int a;int b; } * d) {
return 0;
}
+
+int switchWithoutCases(int x) {
+ switch (x) {
+ };
+ return 0;
+}
Index: clang/include/clang/AST/Stmt.h
===================================================================
--- clang/include/clang/AST/Stmt.h
+++ clang/include/clang/AST/Stmt.h
@@ -2119,7 +2119,7 @@
friend TrailingObjects;
/// Points to a linked list of case and default statements.
- SwitchCase *FirstCase;
+ SwitchCase *FirstCase = nullptr;
// SwitchStmt is followed by several trailing objects,
// some of which optional. Note that it would be more convenient to
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits