Fix handling of unmatched right parens in the REPL

Fixes rdar://14247238 Interpreter hangs and consumes memory on an unmatched right paren


Swift SVN r5849
This commit is contained in:
Dmitri Hrybenko
2013-06-27 22:32:07 +00:00
parent e10ca4cdb6
commit cb8a9f9954

View File

@@ -490,7 +490,7 @@ public:
TranslationUnit *getTU(); TranslationUnit *getTU();
REPLInputKind getREPLInput(llvm::SmallVectorImpl<char> &Line) { REPLInputKind getREPLInput(llvm::SmallVectorImpl<char> &Line) {
unsigned BraceCount = 0; int BraceCount = 0;
bool HadLineContinuation = false; bool HadLineContinuation = false;
bool UnfinishedInfixExpr = false; bool UnfinishedInfixExpr = false;
unsigned CurChunkLines = 0; unsigned CurChunkLines = 0;
@@ -579,7 +579,7 @@ public:
if (*p == ' ' || *p == '\t') if (*p == ' ' || *p == '\t')
UnfinishedInfixExpr = true; UnfinishedInfixExpr = true;
} }
} while (BraceCount != 0 || HadLineContinuation || UnfinishedInfixExpr); } while (BraceCount > 0 || HadLineContinuation || UnfinishedInfixExpr);
// The lexer likes null-terminated data. // The lexer likes null-terminated data.
Line.push_back('\0'); Line.push_back('\0');