[PATCH] D61570: [analyzer] PR41753: Include complex integer types in NonLoc::isCompoundType

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 5 08:58:30 PDT 2019


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:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61570.198181.patch
Type: text/x-patch
Size: 1309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190505/f26b0a59/attachment.bin>


More information about the cfe-commits mailing list