[cfe-commits] r159772 - in /cfe/trunk: lib/Parse/ParseDecl.cpp lib/Parse/Parser.cpp test/SemaObjCXX/delay-parsing-cfunctions.mm

Fariborz Jahanian fjahanian at apple.com
Thu Jul 5 12:34:20 PDT 2012


Author: fjahanian
Date: Thu Jul  5 14:34:20 2012
New Revision: 159772

URL: http://llvm.org/viewvc/llvm-project?rev=159772&view=rev
Log:
objective-c++ parsing. Turn off delayed parsing
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.

Modified:
    cfe/trunk/lib/Parse/ParseDecl.cpp
    cfe/trunk/lib/Parse/Parser.cpp
    cfe/trunk/test/SemaObjCXX/delay-parsing-cfunctions.mm

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=159772&r1=159771&r2=159772&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Thu Jul  5 14:34:20 2012
@@ -1322,7 +1322,9 @@
       // 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) {

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=159772&r1=159771&r2=159772&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Thu Jul  5 14:34:20 2012
@@ -773,9 +773,7 @@
     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

Modified: cfe/trunk/test/SemaObjCXX/delay-parsing-cfunctions.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/delay-parsing-cfunctions.mm?rev=159772&r1=159771&r2=159772&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/delay-parsing-cfunctions.mm (original)
+++ cfe/trunk/test/SemaObjCXX/delay-parsing-cfunctions.mm Thu Jul  5 14:34:20 2012
@@ -3,6 +3,7 @@
 
 struct X {
 X();
+void SortWithCollator();
 };
 
 @interface MyClass
@@ -39,5 +40,5 @@
 int x{17};
 
 X::X() = default;
-
+void X::SortWithCollator() {}
 @end





More information about the cfe-commits mailing list