aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseObjc.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-09 04:34:13 +0000
committerChris Lattner <sabre@nondot.org>2009-01-09 04:34:13 +0000
commit1fd80116b49782c367ff5d5f50a8b76dd8a5d7f7 (patch)
treee3f8a294c520205aaa1f148205ba649acabe45d3 /lib/Parse/ParseObjc.cpp
parent4e174f1b1e95faacc21da2eac70f7853807f3ea3 (diff)
Fix rdar://6480479 - [parser] infinite loop on invalid input
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61975 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r--lib/Parse/ParseObjc.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index f52ecfb7fb..90a1494966 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -255,6 +255,12 @@ void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl,
// If we don't have an @ directive, parse it as a function definition.
if (Tok.isNot(tok::at)) {
+ // The code below does not consume '}'s because it is afraid of eating the
+ // end of a namespace. Because of the way this code is structured, an
+ // erroneous r_brace would cause an infinite loop if not handled here.
+ if (Tok.is(tok::r_brace))
+ break;
+
// FIXME: as the name implies, this rule allows function definitions.
// We could pass a flag or check for functions during semantic analysis.
ParseDeclarationOrFunctionDefinition();