aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-07-20 17:19:54 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-07-20 17:19:54 +0000
commit090d1bd613380a4155c5a79cbd1d5fb4a7368ac6 (patch)
treed1ab37d2bacb45dafb84470c1cf5e4f1c512af16 /lib/Parse/ParseDecl.cpp
parent4423f81705bd834054f9940d4eb9195addaea065 (diff)
Fixes an ObjC++ parse crash caused by delayed parsing
of c-functions nested in namespace in method implementations by turning off its delayed parsing until a proper solution is figured out. pr13418 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160552 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 05d44a5af0..38aff5d4b9 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -1340,9 +1340,12 @@ 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.
+ // FIXME. Delayed parsing not done for c/c++ functions nested in namespace
!isDeclarationAfterDeclarator() &&
(!CurParsedObjCImpl || Tok.isNot(tok::l_brace) ||
- (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()))) {
+ (getLangOpts().CPlusPlus &&
+ (D.getCXXScopeSpec().isSet() ||
+ !Actions.CurContext->isTranslationUnit())))) {
if (isStartOfFunctionDefinition(D)) {
if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {