]> granicus.if.org Git - clang/commitdiff
objective-c++ parsing. Turn off delayed parsing
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 5 Jul 2012 19:34:20 +0000 (19:34 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 5 Jul 2012 19:34:20 +0000 (19:34 +0000)
of out-of-line c++ method definition which happens
to be inside an objc class implementation
until I can figure out how to do it. This is to fix
a broken project.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159772 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
lib/Parse/Parser.cpp
test/SemaObjCXX/delay-parsing-cfunctions.mm

index a96e29556b9822110fd86e55ac430ce255851c69..d91457c0d690cf5eb66c4ad91245a64876264861 100644 (file)
@@ -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) {
index c2c4c900903a3e779818a3a714be86e76e71a2f8..4cc5fdeae0b16e98299e0dcf3d37cc8c9fc29c2f 100644 (file)
@@ -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
index 8e9c319a0e8d2278596e08ded418ac6b4674bc77..fbdf8bad0aa769e39311ec3ce31592137333539b 100644 (file)
@@ -3,6 +3,7 @@
 
 struct X {
 X();
+void SortWithCollator();
 };
 
 @interface MyClass
@@ -39,5 +40,5 @@ static int test() {
 int x{17};
 
 X::X() = default;
-
+void X::SortWithCollator() {}
 @end