aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-07-11 22:24:20 +0000
committerChris Lattner <sabre@nondot.org>2010-07-11 22:24:20 +0000
commitc82daefa3062721e98947e08193cd81b4e9df915 (patch)
treeec36729bbacd5a31756904e7cf366eb9668c9d2a /lib/Parse/ParseDecl.cpp
parent1bdb5a68912ff114fcf681bfb823fff0d1c25a84 (diff)
add a const qualifier, refactor some code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108104 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index df02f95d67..0334209f50 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/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);