diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-08-12 01:46:03 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-08-12 01:46:03 +0000 |
commit | 6c716116dfc8655aec56b5f6cd7a3c99165d86bb (patch) | |
tree | 0aa9c9e4da4052c3bcbe73a609ddc354a256bf6c /clang/lib/Parse/ParseCXXInlineMethods.cpp | |
parent | 4164dd9167f2f049e2a5e1bd3970a6bb45889462 (diff) | |
download | llvm-6c716116dfc8655aec56b5f6cd7a3c99165d86bb.zip llvm-6c716116dfc8655aec56b5f6cd7a3c99165d86bb.tar.gz llvm-6c716116dfc8655aec56b5f6cd7a3c99165d86bb.tar.bz2 |
PR34163: Don't cache an incorrect key function for a class if queried between
the class becoming complete and its inline methods being parsed.
This replaces the hack of using the "late parsed template" flag to track member
functions with bodies we've not parsed yet; instead we now use the "will have
body" flag, which carries the desired implication that the function declaration
*is* a definition, and that we've just not parsed its body yet.
llvm-svn: 310776
Diffstat (limited to 'clang/lib/Parse/ParseCXXInlineMethods.cpp')
-rw-r--r-- | clang/lib/Parse/ParseCXXInlineMethods.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/clang/lib/Parse/ParseCXXInlineMethods.cpp b/clang/lib/Parse/ParseCXXInlineMethods.cpp index c9a895d..2b3d4ba 100644 --- a/clang/lib/Parse/ParseCXXInlineMethods.cpp +++ b/clang/lib/Parse/ParseCXXInlineMethods.cpp @@ -166,20 +166,11 @@ NamedDecl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, } if (FnD) { - // If this is a friend function, mark that it's late-parsed so that - // it's still known to be a definition even before we attach the - // parsed body. Sema needs to treat friend function definitions - // differently during template instantiation, and it's possible for - // the containing class to be instantiated before all its member - // function definitions are parsed. - // - // If you remove this, you can remove the code that clears the flag - // after parsing the member. - if (D.getDeclSpec().isFriendSpecified()) { - FunctionDecl *FD = FnD->getAsFunction(); - Actions.CheckForFunctionRedefinition(FD); - FD->setLateTemplateParsed(true); - } + FunctionDecl *FD = FnD->getAsFunction(); + // Track that this function will eventually have a body; Sema needs + // to know this. + Actions.CheckForFunctionRedefinition(FD); + FD->setWillHaveBody(true); } else { // If semantic analysis could not build a function declaration, // just throw away the late-parsed declaration. @@ -559,10 +550,6 @@ void Parser::ParseLexedMethodDef(LexedMethod &LM) { ParseFunctionStatementBody(LM.D, FnScope); - // Clear the late-template-parsed bit if we set it before. - if (LM.D) - LM.D->getAsFunction()->setLateTemplateParsed(false); - while (Tok.isNot(tok::eof)) ConsumeAnyToken(); |