aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Lex/Lexer.cpp3
-rw-r--r--test/Lexer/conflict-marker.c5
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index 83de8c83a9..0925dd73fe 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -1422,6 +1422,7 @@ static const char *FindConflictEnd(const char *CurPtr, const char *BufferEnd) {
if (RestOfBuffer[Pos-1] != '\r' &&
RestOfBuffer[Pos-1] != '\n') {
RestOfBuffer = RestOfBuffer.substr(Pos+7);
+ Pos = RestOfBuffer.find(">>>>>>>");
continue;
}
return RestOfBuffer.data()+Pos;
@@ -1451,7 +1452,7 @@ bool Lexer::IsStartOfConflictMarker(const char *CurPtr) {
// Check to see if there is a >>>>>>> somewhere in the buffer at the start of
// a line to terminate this conflict marker.
- if (FindConflictEnd(CurPtr+7, BufferEnd)) {
+ if (FindConflictEnd(CurPtr, BufferEnd)) {
// We found a match. We are really in a conflict marker.
// Diagnose this, and ignore to the end of line.
Diag(CurPtr, diag::err_conflict_marker);
diff --git a/test/Lexer/conflict-marker.c b/test/Lexer/conflict-marker.c
index f86111c3aa..45efdec826 100644
--- a/test/Lexer/conflict-marker.c
+++ b/test/Lexer/conflict-marker.c
@@ -4,7 +4,7 @@
// PR5238
// diff3 style
-<<<<<<< .mine // expected-error {{version control conflict marker in file}}
+<<<<<<< .mine // expected-error {{version control conflict marker in file}}
int x = 4;
|||||||
int x = 123;
@@ -13,7 +13,7 @@ float x = 17;
>>>>>>> .r91107
// normal style.
-<<<<<<< .mine // expected-error {{version control conflict marker in file}}
+<<<<<<< .mine // expected-error {{version control conflict marker in file}}
typedef int y;
=======
typedef struct foo *y;
@@ -22,6 +22,7 @@ typedef struct foo *y;
;
y b;
+
int foo() {
y a = x;
return x + a;