// RUN: not %clang_cc1 -std=c++11 -fcaret-diagnostics-max-lines 5 -Wsometimes-uninitialized %s 2>&1 | FileCheck %s --strict-whitespace
void ;
// Check we expand the range as much as possible within the limit.
// CHECK: warning: variable 'a' is used uninitialized whenever 'if' condition is true
// CHECK-NEXT: {{^}} if (cond) {
// CHECK-NEXT: {{^}} ^~~~{{$}}
// CHECK-NEXT: note: uninitialized use occurs here
// CHECK-NEXT: {{^}} return a;
// CHECK-NEXT: {{^}} ^
// CHECK-NEXT: note: remove the 'if' if its condition is always false
// CHECK-NEXT: {{^}} if (cond) {
// CHECK-NEXT: {{^}} ^~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(1);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} } else {
// CHECK-NEXT: {{^}}~~~~~~~~~{{$}}
// CHECK-NEXT: note: initialize the variable
int
// CHECK: warning: variable 'a' is used uninitialized whenever 'if' condition is true
// CHECK-NEXT: {{^}} if (cond) {
// CHECK-NEXT: {{^}} ^~~~{{$}}
// CHECK-NEXT: note: uninitialized use occurs here
// CHECK-NEXT: {{^}} return a;
// CHECK-NEXT: {{^}} ^
// CHECK-NEXT: note: remove the 'if' if its condition is always false
// CHECK-NEXT: {{^}} if (cond) {
// CHECK-NEXT: {{^}} ^~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(1);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(2);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} } else {
// CHECK-NEXT: {{^}}~~~~~~~~~{{$}}
// CHECK-NEXT: note: initialize the variable
int
// CHECK: warning: variable 'a' is used uninitialized whenever 'if' condition is true
// CHECK-NEXT: {{^}} if (cond) {
// CHECK-NEXT: {{^}} ^~~~{{$}}
// CHECK-NEXT: note: uninitialized use occurs here
// CHECK-NEXT: {{^}} return a;
// CHECK-NEXT: {{^}} ^
// CHECK-NEXT: note: remove the 'if' if its condition is always false
// CHECK-NEXT: {{^}} if (cond) {
// CHECK-NEXT: {{^}} ^~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(1);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(2);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(3);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} } else {
// CHECK-NEXT: {{^}}~~~~~~~~~{{$}}
// CHECK-NEXT: note: initialize the variable
int
// CHECK: warning: variable 'a' is used uninitialized whenever 'if' condition is true
// CHECK-NEXT: {{^}} if (cond) {
// CHECK-NEXT: {{^}} ^~~~{{$}}
// CHECK-NEXT: note: uninitialized use occurs here
// CHECK-NEXT: {{^}} return a;
// CHECK-NEXT: {{^}} ^
// CHECK-NEXT: note: remove the 'if' if its condition is always false
// CHECK-NEXT: {{^}} if (cond) {
// CHECK-NEXT: {{^}} ^~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(1);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(2);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(3);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(4);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: note: initialize the variable
int
// CHECK: warning: variable 'a' is used uninitialized whenever 'if' condition is true
// CHECK-NEXT: {{^}} if (cond) {
// CHECK-NEXT: {{^}} ^~~~{{$}}
// CHECK-NEXT: note: uninitialized use occurs here
// CHECK-NEXT: {{^}} return a;
// CHECK-NEXT: {{^}} ^
// CHECK-NEXT: note: remove the 'if' if its condition is always false
// CHECK-NEXT: {{^}} if (cond) {
// CHECK-NEXT: {{^}} ^~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(1);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(2);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(3);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: {{^}} line(4);
// CHECK-NEXT: {{^}}~~~~~~~~~~~~{{$}}
// CHECK-NEXT: note: initialize the variable
int
// Check that we don't include lines with no interesting code if we can't reach
// the interesting part within the line limit.
// CHECK: error: no matching function for call to 'g
// CHECK: note: candidate template ignored: substitution failure
// CHECK-NEXT: {{^}}decltype(T()
// CHECK-NEXT: {{^}} ~{{$}}
// CHECK-NEXT: {{^}} + 1
// CHECK-NEXT: {{^}} + 2
// CHECK-NEXT: {{^}} + 3
// CHECK-NEXT: {{^}}void g();
// CHECK-NEXT: {{^}} ^{{$}}
decltype
void ;
// CHECK: note: candidate template ignored: substitution failure
// CHECK-NEXT: {{^}}void g();
// CHECK-NEXT: {{^}} ^{{$}}
decltype
void ;
void
void