diff options
Diffstat (limited to 'test/Analysis/identical-expressions.cpp')
-rw-r--r-- | test/Analysis/identical-expressions.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/Analysis/identical-expressions.cpp b/test/Analysis/identical-expressions.cpp index 85e3322..46dd562 100644 --- a/test/Analysis/identical-expressions.cpp +++ b/test/Analysis/identical-expressions.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core.IdenticalExpr -verify %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core.IdenticalExpr -w -verify %s /* Only one expected warning per function allowed at the very end. */ @@ -1511,3 +1511,22 @@ void test_nowarn_chained_if_stmts_3(int x) { else if (x++) // no-warning ; } + +void test_warn_wchar() { + const wchar_t * a = 0 ? L"Warning" : L"Warning"; // expected-warning {{identical expressions on both sides of ':' in conditional expression}} +} +void test_nowarn_wchar() { + const wchar_t * a = 0 ? L"No" : L"Warning"; +} + +void test_nowarn_long() { + int a = 0, b = 0; + long c; + if (0) { + b -= a; + c = 0; + } else { // no-warning + b -= a; + c = 0LL; + } +} |