[PATCH] D106152: [analyzer] Move test case to existing test file and remove duplicated test file.

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 19 02:34:19 PDT 2021


ASDenysPetrov updated this revision to Diff 359710.
ASDenysPetrov retitled this revision from "[analyzer] Remove test file as duplicated." to "[analyzer] Move test case to existing test file and remove duplicated test file.".
ASDenysPetrov edited the summary of this revision.
ASDenysPetrov added a comment.

Moved the test case to existing file.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106152/new/

https://reviews.llvm.org/D106152

Files:
  clang/test/Analysis/PR46264.cpp
  clang/test/Analysis/diagnostics/PR46264.cpp


Index: clang/test/Analysis/diagnostics/PR46264.cpp
===================================================================
--- clang/test/Analysis/diagnostics/PR46264.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=text -verify %s
-
-// PR46264
-// This case shall not crash with an assertion failure about void* dereferening.
-// The crash has been last seen on commit
-// `3ed8ebc2f6b8172bed48cc5986d3b7af4cfca1bc` from 24.05.2020.
-namespace ns1 {
-namespace a {
-class b {
-public:
-  typedef int b::*c;
-  operator c() { return d ? &b::d : 0; }
-  // expected-note at -1{{'?' condition is true}}
-  // expected-note at -2{{Assuming field 'd' is not equal to 0}}
-  // expected-note at -3{{Returning value, which participates in a condition later}}
-  int d;
-};
-} // namespace a
-using a::b;
-class e {
-  void f();
-  void g();
-  b h;
-};
-void e::f() {
-  e *i;
-  // expected-note at -1{{'i' declared without an initial value}}
-  if (h)
-    // expected-note at -1{{Taking true branch}}
-    // expected-note at -2{{'b::operator int ns1::a::b::*'}}
-    // expected-note at -3{{Returning from 'b::operator int ns1::a::b::*'}}
-    i->g();
-  // expected-note at -1{{Called C++ object pointer is uninitialized}}
-  // expected-warning at -2{{Called C++ object pointer is uninitialized}}
-}
-} // namespace ns1
Index: clang/test/Analysis/PR46264.cpp
===================================================================
--- clang/test/Analysis/PR46264.cpp
+++ clang/test/Analysis/PR46264.cpp
@@ -33,3 +33,27 @@
 
   return 10;
 }
+
+// PR46264
+// This case shall not crash with an assertion failure about void* dereferening.
+namespace ns1 {
+namespace a {
+class b {
+public:
+  typedef int b::*c;
+  operator c() { return d ? &b::d : 0; }
+  int d;
+};
+} // namespace a
+using a::b;
+class e {
+  void f();
+  void g();
+  b h;
+};
+void e::f() {
+  e *i;
+  if (h)
+    i->g(); // expected-warning{{Called C++ object pointer is uninitialized}}
+}
+} // namespace ns1


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106152.359710.patch
Type: text/x-patch
Size: 2003 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210719/9e7c9ba7/attachment.bin>


More information about the cfe-commits mailing list