diff options
author | Chris Lattner <sabre@nondot.org> | 2010-07-11 22:24:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-07-11 22:24:20 +0000 |
commit | dbb1e93a9fc79d136ffbaea0dbe5342785ab9d2e (patch) | |
tree | 56f62f9834d405d4654541e6fecc884ce0741eba /clang/lib/Parse/ParseDecl.cpp | |
parent | 2c52b7997c5a748ed8251ca40dd0e28db28f99fa (diff) | |
download | bcm5719-llvm-dbb1e93a9fc79d136ffbaea0dbe5342785ab9d2e.tar.gz bcm5719-llvm-dbb1e93a9fc79d136ffbaea0dbe5342785ab9d2e.zip |
add a const qualifier, refactor some code.
llvm-svn: 108104
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index df02f95d675..0334209f504 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -395,12 +395,14 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS, return DeclGroupPtrTy(); } - if (AllowFunctionDefinitions && D.isFunctionDeclarator()) { - if (isDeclarationAfterDeclarator()) { - // Fall though. We have to check this first, though, because - // __attribute__ might be the start of a function definition in - // (extended) K&R C. - } else if (isStartOfFunctionDefinition()) { + // 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()) { if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef) { Diag(Tok, diag::err_function_declared_typedef); |