summaryrefslogtreecommitdiffstats
path: root/clang/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
commitc7c9ab794792efe47c5f326421b8ff259a46a65d (patch)
tree8b077444160f1fcf6c7f1f67071d2c69aff9950a /clang/lib/Parse/ParseObjc.cpp
parentcc1b6e8fce4ac53dc78ed09a4a141e7d50767347 (diff)
downloadbcm5719-llvm-c7c9ab794792efe47c5f326421b8ff259a46a65d.tar.gz
bcm5719-llvm-c7c9ab794792efe47c5f326421b8ff259a46a65d.zip
Fix rdar://6480479 - [parser] infinite loop on invalid input
llvm-svn: 61975
Diffstat (limited to 'clang/lib/Parse/ParseObjc.cpp')
-rw-r--r--clang/lib/Parse/ParseObjc.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index f52ecfb7fb1..90a14949667 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/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();
OpenPOWER on IntegriCloud