aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Parse/ParseDecl.cpp4
-rw-r--r--lib/Parse/Parser.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index a96e29556b..d91457c0d6 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -1322,7 +1322,9 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
// Look at the next token to make sure that this isn't a function
// declaration. We have to check this because __attribute__ might be the
// start of a function definition in GCC-extended K&R C.
- !isDeclarationAfterDeclarator()) {
+ !isDeclarationAfterDeclarator() &&
+ (!CurParsedObjCImpl || Tok.isNot(tok::l_brace) ||
+ (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()))) {
if (isStartOfFunctionDefinition(D)) {
if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index c2c4c90090..4cc5fdeae0 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -773,9 +773,7 @@ bool Parser::isDeclarationAfterDeclarator() {
Tok.is(tok::kw_asm) || // int X() __asm__ -> not a function def
Tok.is(tok::kw___attribute) || // int X() __attr__ -> not a function def
(getLangOpts().CPlusPlus &&
- Tok.is(tok::l_paren)) || // int X(0) -> not a function def [C++]
- (CurParsedObjCImpl &&
- Tok.is(tok::l_brace)); // C-function nested in an @implementation
+ Tok.is(tok::l_paren)); // int X(0) -> not a function def [C++]
}
/// \brief Determine whether the current token, if it occurs after a