diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-07-05 19:34:20 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-07-05 19:34:20 +0000 |
commit | 8de7955f3540a4a04b9b94043cb64da3c2563c0a (patch) | |
tree | a1c34369d06dc0595d446c180460878ef0e7a3af /clang | |
parent | bbf374c4c60c5e5ebc75ddbd92a326e9d264a804 (diff) | |
download | bcm5719-llvm-8de7955f3540a4a04b9b94043cb64da3c2563c0a.tar.gz bcm5719-llvm-8de7955f3540a4a04b9b94043cb64da3c2563c0a.zip |
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.
llvm-svn: 159772
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Parse/Parser.cpp | 4 | ||||
-rw-r--r-- | clang/test/SemaObjCXX/delay-parsing-cfunctions.mm | 3 |
3 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index a96e29556b9..d91457c0d69 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/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/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index c2c4c900903..4cc5fdeae0b 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/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 diff --git a/clang/test/SemaObjCXX/delay-parsing-cfunctions.mm b/clang/test/SemaObjCXX/delay-parsing-cfunctions.mm index 8e9c319a0e8..fbdf8bad0aa 100644 --- a/clang/test/SemaObjCXX/delay-parsing-cfunctions.mm +++ b/clang/test/SemaObjCXX/delay-parsing-cfunctions.mm @@ -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 |