aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-11-30 23:45:35 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-11-30 23:45:35 +0000
commit58196dc06ee27cd4150ef483123e1e3b2c772821 (patch)
tree42f8735710b4381008bc8c3d36c7cd6405ff65c8 /lib/Parse/ParseDecl.cpp
parent863eb53b5c97037874129b33711e0b668ce73975 (diff)
Revert most of r145372 for now. Lookahead beyond the ';' in a function
declaration tickles a bug in the way we handle visibility pragmas. The improvement to error recovery for template function definitions declared with the 'typedef' specifier in r145372 is unrelated and not reverted here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145541 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp17
1 files changed, 1 insertions, 16 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 75c423340c..3bddd3de13 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -1041,28 +1041,13 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
return DeclGroupPtrTy();
}
- // Do we have a stray semicolon in the middle of a function definition?
- if (AllowFunctionDefinitions && D.isFunctionDeclarator() &&
- Tok.is(tok::semi) && Context == Declarator::FileContext) {
- const Token &Next = NextToken();
- if (Next.is(tok::l_brace) || Next.is(tok::kw_try) ||
- (getLang().CPlusPlus &&
- (Next.is(tok::colon) || Next.is(tok::equal)))) {
- // Pretend we didn't see the semicolon.
- SourceLocation SemiLoc = ConsumeToken();
- Diag(SemiLoc, diag::err_stray_semi_function_definition)
- << FixItHint::CreateRemoval(SemiLoc);
- assert(isStartOfFunctionDefinition(D) && "expected a function defn");
- }
- }
-
// Check to see if we have a function *definition* which must have a body.
if (AllowFunctionDefinitions && D.isFunctionDeclarator() &&
// 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()) {
-
+
if (isStartOfFunctionDefinition(D)) {
if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
Diag(Tok, diag::err_function_declared_typedef);