Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -verify -fsyntax-only |
Chris Lattner | 34f349d | 2009-12-14 06:16:57 +0000 | [diff] [blame] | 2 | |
| 3 | // Test that we recover gracefully from conflict markers left in input files. |
| 4 | // PR5238 |
| 5 | |
| 6 | // diff3 style |
Chris Lattner | 3d48899 | 2010-05-17 20:27:25 +0000 | [diff] [blame] | 7 | <<<<<<< .mine // expected-error {{version control conflict marker in file}} |
Chris Lattner | 34f349d | 2009-12-14 06:16:57 +0000 | [diff] [blame] | 8 | int x = 4; |
| 9 | ||||||| |
| 10 | int x = 123; |
| 11 | ======= |
| 12 | float x = 17; |
| 13 | >>>>>>> .r91107 |
| 14 | |
| 15 | // normal style. |
Chris Lattner | 3d48899 | 2010-05-17 20:27:25 +0000 | [diff] [blame] | 16 | <<<<<<< .mine // expected-error {{version control conflict marker in file}} |
Chris Lattner | 34f349d | 2009-12-14 06:16:57 +0000 | [diff] [blame] | 17 | typedef int y; |
| 18 | ======= |
| 19 | typedef struct foo *y; |
| 20 | >>>>>>> .r91107 |
| 21 | |
Richard Smith | d5e1d60 | 2011-10-12 00:37:51 +0000 | [diff] [blame^] | 22 | // Perforce style. |
| 23 | >>>> ORIGINAL conflict-marker.c#6 // expected-error {{version control conflict marker in file}} |
| 24 | int z = 1; |
| 25 | ==== THEIRS conflict-marker.c#7 |
| 26 | int z = 0; |
| 27 | ==== YOURS conflict-marker.c |
| 28 | int z = 2; |
| 29 | <<<< |
| 30 | |
Chris Lattner | 34f349d | 2009-12-14 06:16:57 +0000 | [diff] [blame] | 31 | ; |
| 32 | y b; |
| 33 | |
Chris Lattner | 3d48899 | 2010-05-17 20:27:25 +0000 | [diff] [blame] | 34 | |
Chris Lattner | 34f349d | 2009-12-14 06:16:57 +0000 | [diff] [blame] | 35 | int foo() { |
| 36 | y a = x; |
Richard Smith | d5e1d60 | 2011-10-12 00:37:51 +0000 | [diff] [blame^] | 37 | return x + a - z; |
Chris Lattner | 34f349d | 2009-12-14 06:16:57 +0000 | [diff] [blame] | 38 | } |