diff options
| author | Kristof Umann <kristof.umann@ericsson.com> | 2019-05-05 19:42:33 +0000 |
|---|---|---|
| committer | Kristof Umann <kristof.umann@ericsson.com> | 2019-05-05 19:42:33 +0000 |
| commit | aa9d2623a055e92ec27fb74103c2ae72e6914408 (patch) | |
| tree | e072ac164642245ab196e18490eb002b9e1696ba /clang/test/Analysis/cxx-uninitialized-object.cpp | |
| parent | 02569408efe0f30ce8ca6f1210e015162f880056 (diff) | |
| download | bcm5719-llvm-aa9d2623a055e92ec27fb74103c2ae72e6914408.tar.gz bcm5719-llvm-aa9d2623a055e92ec27fb74103c2ae72e6914408.zip | |
[analyzer][UninitializedObjectChecker] PR41741: Regard all scalar types as primitive.
https://bugs.llvm.org/show_bug.cgi?id=41741
Pretty much the same as D61246 and D61106, this time for __complex__ types. Upon
further investigation, I realized that we should regard all types
Type::isScalarType returns true for as primitive, so I merged
isMemberPointerType(), isBlockPointerType() and isAnyComplexType()` into that
instead.
I also stumbled across yet another bug,
https://bugs.llvm.org/show_bug.cgi?id=41753, but it seems to be unrelated to
this checker.
Differential Revision: https://reviews.llvm.org/D61569
llvm-svn: 359998
Diffstat (limited to 'clang/test/Analysis/cxx-uninitialized-object.cpp')
| -rw-r--r-- | clang/test/Analysis/cxx-uninitialized-object.cpp | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/clang/test/Analysis/cxx-uninitialized-object.cpp b/clang/test/Analysis/cxx-uninitialized-object.cpp index a8113198541..dde99dc9540 100644 --- a/clang/test/Analysis/cxx-uninitialized-object.cpp +++ b/clang/test/Analysis/cxx-uninitialized-object.cpp @@ -1,11 +1,15 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=core,optin.cplusplus.UninitializedObject \ +// RUN: %clang_analyze_cc1 -std=c++14 -verify %s \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=optin.cplusplus.UninitializedObject \ // RUN: -analyzer-config optin.cplusplus.UninitializedObject:Pedantic=true -DPEDANTIC \ -// RUN: -analyzer-config optin.cplusplus.UninitializedObject:CheckPointeeInitialization=true \ -// RUN: -std=c++14 -verify %s +// RUN: -analyzer-config \ +// RUN: optin.cplusplus.UninitializedObject:CheckPointeeInitialization=true -// RUN: %clang_analyze_cc1 -analyzer-checker=core,optin.cplusplus.UninitializedObject \ -// RUN: -analyzer-config optin.cplusplus.UninitializedObject:CheckPointeeInitialization=true \ -// RUN: -std=c++14 -verify %s +// RUN: %clang_analyze_cc1 -std=c++14 -verify %s \ +// RUN: -analyzer-checker=core \ +// RUN: -analyzer-checker=optin.cplusplus.UninitializedObject \ +// RUN: -analyzer-config \ +// RUN: optin.cplusplus.UninitializedObject:CheckPointeeInitialization=true //===----------------------------------------------------------------------===// // Default constructor test. @@ -1156,3 +1160,28 @@ void __vector_size__LongTest() { VectorSizeLong v; v.x[0] = 0; } + +struct ComplexUninitTest { + ComplexUninitTest() {} + __complex__ float x; + __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; +//}; + +void fComplexTest() { +// ComplexInitTest x; + + // TODO: we should emit a warning for x2.x and x2.y. + ComplexUninitTest x2; +} |

