Szelethus created this revision.
Szelethus added reviewers: NoQ, dcoughlin, baloghadamsoftware, xazax.hun, 
rnkovacs, Charusso, a_sidorin.
Szelethus added a project: clang.
Herald added subscribers: cfe-commits, gamesh411, dkrupp, donat.nagy, 
mikhail.ramalho, a.sidorin, szepet, whisperity.

https://bugs.llvm.org/show_bug.cgi?id=41753

Caused a crash while fixing another bug, turned out to be easier to fix than 
expected :)


Repository:
  rC Clang

https://reviews.llvm.org/D61570

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
  test/Analysis/cxx-uninitialized-object.cpp


Index: test/Analysis/cxx-uninitialized-object.cpp
===================================================================
--- test/Analysis/cxx-uninitialized-object.cpp
+++ test/Analysis/cxx-uninitialized-object.cpp
@@ -1167,20 +1167,17 @@
   __complex__ int y;
 };
 
-// FIXME: Currently this causes (unrelated to this checker) an assertion
-// failure.
-//
-//struct ComplexInitTest {
-//  ComplexInitTest() {
-//    x = {1.0f, 1.0f};
-//    y = {1, 1};
-//  }
-//  __complex__ float x;
-//  __complex__ int y;
-//};
+struct ComplexInitTest {
+  ComplexInitTest() {
+    x = {1.0f, 1.0f};
+    y = {1, 1};
+  }
+  __complex__ float x;
+  __complex__ int y;
+};
 
 void fComplexTest() {
-//  ComplexInitTest x;
+  ComplexInitTest x;
 
   // TODO: we should emit a warning for x2.x and x2.y.
   ComplexUninitTest x2;
Index: include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
===================================================================
--- include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -303,7 +303,7 @@
 
   static bool isCompoundType(QualType T) {
     return T->isArrayType() || T->isRecordType() ||
-           T->isComplexType() || T->isVectorType();
+           T->isAnyComplexType() || T->isVectorType();
   }
 
 private:


Index: test/Analysis/cxx-uninitialized-object.cpp
===================================================================
--- test/Analysis/cxx-uninitialized-object.cpp
+++ test/Analysis/cxx-uninitialized-object.cpp
@@ -1167,20 +1167,17 @@
   __complex__ int y;
 };
 
-// FIXME: Currently this causes (unrelated to this checker) an assertion
-// failure.
-//
-//struct ComplexInitTest {
-//  ComplexInitTest() {
-//    x = {1.0f, 1.0f};
-//    y = {1, 1};
-//  }
-//  __complex__ float x;
-//  __complex__ int y;
-//};
+struct ComplexInitTest {
+  ComplexInitTest() {
+    x = {1.0f, 1.0f};
+    y = {1, 1};
+  }
+  __complex__ float x;
+  __complex__ int y;
+};
 
 void fComplexTest() {
-//  ComplexInitTest x;
+  ComplexInitTest x;
 
   // TODO: we should emit a warning for x2.x and x2.y.
   ComplexUninitTest x2;
Index: include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
===================================================================
--- include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
+++ include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
@@ -303,7 +303,7 @@
 
   static bool isCompoundType(QualType T) {
     return T->isArrayType() || T->isRecordType() ||
-           T->isComplexType() || T->isVectorType();
+           T->isAnyComplexType() || T->isVectorType();
   }
 
 private:
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to