[PATCH] D61246: [analyzer][UninitializedObjectChecker] PR41611: Regard vector types as primitive
Kristóf Umann via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 30 01:48:00 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL359539: [analyzer][UninitializedObjectChecker] PR41611: Regard vector types as primitive (authored by Szelethus, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D61246?vs=197209&id=197276#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61246/new/
https://reviews.llvm.org/D61246
Files:
cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
cfe/trunk/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
cfe/trunk/test/Analysis/cxx-uninitialized-object.cpp
Index: cfe/trunk/test/Analysis/cxx-uninitialized-object.cpp
===================================================================
--- cfe/trunk/test/Analysis/cxx-uninitialized-object.cpp
+++ cfe/trunk/test/Analysis/cxx-uninitialized-object.cpp
@@ -1132,7 +1132,7 @@
}
//===----------------------------------------------------------------------===//
-// _Atomic tests.
+// "Esoteric" primitive type tests.
//===----------------------------------------------------------------------===//
struct MyAtomicInt {
@@ -1142,6 +1142,17 @@
MyAtomicInt() {} // expected-warning{{1 uninitialized field}}
};
-void entry() {
+void _AtomicTest() {
MyAtomicInt b;
}
+
+struct VectorSizeLong {
+ VectorSizeLong() {}
+ __attribute__((__vector_size__(16))) long x;
+};
+
+void __vector_size__LongTest() {
+ // TODO: Warn for v.x.
+ VectorSizeLong v;
+ v.x[0] = 0;
+}
Index: cfe/trunk/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
===================================================================
--- cfe/trunk/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
+++ cfe/trunk/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp
@@ -256,6 +256,29 @@
CharPointerTest();
}
+struct VectorSizePointer {
+ VectorSizePointer() {} // expected-warning{{1 uninitialized field}}
+ __attribute__((__vector_size__(8))) int *x; // expected-note{{uninitialized pointer 'this->x'}}
+ int dontGetFilteredByNonPedanticMode = 0;
+};
+
+void __vector_size__PointerTest() {
+ VectorSizePointer v;
+}
+
+struct VectorSizePointee {
+ using MyVectorType = __attribute__((__vector_size__(8))) int;
+ MyVectorType *x;
+
+ VectorSizePointee(decltype(x) x) : x(x) {}
+};
+
+void __vector_size__PointeeTest() {
+ VectorSizePointee::MyVectorType i;
+ // TODO: Report v.x's pointee.
+ VectorSizePointee v(&i);
+}
+
struct CyclicPointerTest1 {
int *ptr; // expected-note{{object references itself 'this->ptr'}}
int dontGetFilteredByNonPedanticMode = 0;
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
@@ -324,7 +324,8 @@
inline bool isPrimitiveType(const QualType &T) {
return T->isBuiltinType() || T->isEnumeralType() ||
T->isMemberPointerType() || T->isBlockPointerType() ||
- T->isFunctionType() || T->isAtomicType();
+ T->isFunctionType() || T->isAtomicType() ||
+ T->isVectorType();
}
inline bool isDereferencableType(const QualType &T) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61246.197276.patch
Type: text/x-patch
Size: 2659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190430/d0c75bf0/attachment.bin>
More information about the llvm-commits
mailing list