aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-08-25 21:31:01 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-08-25 21:31:01 +0000
commiteb4b7051a596560ef4a1846e3714707f44e9dc30 (patch)
tree594c0010b8352c42c8003c98aab7ee759e0ce040 /lib/Sema/SemaDecl.cpp
parentc9e56b2a63f023b298d92fc572c0d47538aae964 (diff)
Do typechecking and codegen for K&R-style function declarations
correctly. Not a regression, but made more obvious by my recent fix which made function type compatibility checking a bit more strict. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55339 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 066969ce9e..ad83908e45 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -690,8 +690,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
// Copy the parameter declarations from the declarator D to
// the function declaration NewFD, if they are available.
- if (D.getNumTypeObjects() > 0 &&
- D.getTypeObject(0).Fun.hasPrototype) {
+ if (D.getNumTypeObjects() > 0) {
DeclaratorChunk::FunctionTypeInfo &FTI = D.getTypeObject(0).Fun;
// Create Decl objects for each parameter, adding them to the
@@ -716,7 +715,7 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl) {
Diag(Param->getLocation(), diag::ext_param_typedef_of_void);
}
- } else {
+ } else if (FTI.NumArgs > 0 && FTI.ArgInfo[0].Param != 0) {
for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i)
Params.push_back((ParmVarDecl *)FTI.ArgInfo[i].Param);
}
@@ -1540,11 +1539,6 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
FTI.ArgInfo[i].Param = ActOnParamDeclarator(FnBodyScope, ParamD);
}
}
-
- // Since this is a function definition, act as though we have information
- // about the arguments.
- if (FTI.NumArgs)
- FTI.hasPrototype = true;
} else {
// FIXME: Diagnose arguments without names in C.
}