Files
clang-p2996/clang-tools-extra/test/clang-tidy/checkers/readability/uppercase-literal-suffix-floating-point-opencl-half.cpp
Timm Bäder f63155aaa6 [clang] Show line numbers in diagnostic code snippets
Show line numbers to the left of diagnostic code snippets and increase
the numbers of lines shown from 1 to 16.

Differential Revision: https://reviews.llvm.org/D147875
2023-05-31 07:26:03 +02:00

31 lines
1.2 KiB
C++

// RUN: %check_clang_tidy -std=cl2.0 %s readability-uppercase-literal-suffix %t -- -- -target x86_64-pc-linux-gnu -I %S -x cl
// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -fix -- -target x86_64-pc-linux-gnu -I %S -std=cl2.0 -x cl
// RUN: clang-tidy %t.cpp -checks='-*,readability-uppercase-literal-suffix' -warnings-as-errors='-*,readability-uppercase-literal-suffix' -- -target x86_64-pc-linux-gnu -I %S -std=cl2.0 -x cl
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
void floating_point_half_suffix() {
static half v0 = 0x0p0; // no literal
// half
static half v2 = 1.h;
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: floating point literal has suffix 'h', which is not uppercase
// CHECK-MESSAGES-NEXT: static half v2 = 1.h;
// CHECK-MESSAGES-NEXT: ^ ~
// CHECK-MESSAGES-NEXT: H{{$}}
// CHECK-HIXES: static half v2 = 1.H;
static half v3 = 1.e0h;
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: floating point literal has suffix 'h', which is not uppercase
// CHECK-MESSAGES-NEXT: static half v3 = 1.e0h;
// CHECK-MESSAGES-NEXT: ^ ~
// CHECK-MESSAGES-NEXT: H{{$}}
// CHECK-HIXES: static half v3 = 1.e0H;
static half v4 = 1.H; // OK.
static half v5 = 1.e0H; // OK.
}