Home | History | Annotate | Download | only in Misc
      1 // RUN: not %clang_cc1 -fsyntax-only -verify %s 2>&1 | FileCheck %s
      2 
      3 // Test the -verify flag.  Each of the "x = y;" lines will produce a
      4 // "use of undeclared identifier 'y'" error message.
      5 
      6 void test() {
      7   int x;
      8   // Proper matches here.
      9   x = y; // expected-error{{use of undeclared identifier 'y'}}
     10   x = y; // expected-error{{use of undeclared identifier}}
     11   x = y; // expected-error{{undeclared identifier 'y'}}
     12   x = y; // expected-error{{use of}}
     13   x = y; // expected-error{{undeclared identifier}}
     14   x = y; // expected-error{{'y'}}
     15 
     16   // Bad matches here.
     17   x = y; // expected-error{{use of undeclared identifier 'y' is fine}}
     18   x = y; // expected-error{{abuse of undeclared identifier 'y'}}
     19   x = y; // expected-error{{good use of undeclared identifier 'y' in code}}
     20   x = y; // expected-error{{ use of undeclared identifier 'y' }}
     21   x = y; // expected-error{{use of undeclared identifier 'y' is disallowed}}
     22   x = y; // expected-error{{please don't use of undeclared identifier 'y'}}
     23   x = y; // expected-error{{use of undeclared identifier 'y'; please declare y before use}}
     24   x = y; // expected-error{{use of use of undeclared identifier 'y'}}
     25   x = y; // expected-error{{use of undeclared identifier 'y' identifier 'y'}}
     26 }
     27 
     28 //CHECK: error: 'error' diagnostics expected but not seen:
     29 //CHECK:   Line 17: use of undeclared identifier 'y' is fine
     30 //CHECK:   Line 18: abuse of undeclared identifier 'y'
     31 //CHECK:   Line 19: good use of undeclared identifier 'y' in code
     32 //CHECK:   Line 20:  use of undeclared identifier 'y'
     33 //CHECK:   Line 21: use of undeclared identifier 'y' is disallowed
     34 //CHECK:   Line 22: please don't use of undeclared identifier 'y'
     35 //CHECK:   Line 23: use of undeclared identifier 'y'; please declare y before use
     36 //CHECK:   Line 24: use of use of undeclared identifier 'y'
     37 //CHECK:   Line 25: use of undeclared identifier 'y' identifier 'y'
     38 //CHECK: error: 'error' diagnostics seen but not expected:
     39 //CHECK:   Line 17: use of undeclared identifier 'y'
     40 //CHECK:   Line 18: use of undeclared identifier 'y'
     41 //CHECK:   Line 19: use of undeclared identifier 'y'
     42 //CHECK:   Line 20: use of undeclared identifier 'y'
     43 //CHECK:   Line 21: use of undeclared identifier 'y'
     44 //CHECK:   Line 22: use of undeclared identifier 'y'
     45 //CHECK:   Line 23: use of undeclared identifier 'y'
     46 //CHECK:   Line 24: use of undeclared identifier 'y'
     47 //CHECK:   Line 25: use of undeclared identifier 'y'
     48 //CHECK: 18 errors generated.
     49