Several improvements from Doug Gregor related to default
argument handling. I'll fix up the c89 (void) thing next.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49459 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 4393b80..5e155f8 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -394,7 +394,8 @@
llvm::SmallVector<QualType, 16> ArgTys;
for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
- QualType ArgTy = ((ParmVarDecl *)FTI.ArgInfo[i].Param)->getType();
+ ParmVarDecl *Param = (ParmVarDecl *)FTI.ArgInfo[i].Param;
+ QualType ArgTy = Param->getType();
assert(!ArgTy.isNull() && "Couldn't parse type?");
//
// Perform the default function/array conversion (C99 6.7.5.3p[7,8]).
@@ -425,13 +426,13 @@
if (FTI.NumArgs != 1 || FTI.isVariadic) {
Diag(DeclType.Loc, diag::err_void_only_param);
ArgTy = Context.IntTy;
- ((ParmVarDecl *)FTI.ArgInfo[i].Param)->setType(ArgTy);
+ Param->setType(ArgTy);
} else if (FTI.ArgInfo[i].Ident) {
// Reject, but continue to parse 'int(void abc)'.
Diag(FTI.ArgInfo[i].IdentLoc,
diag::err_param_with_void_type);
ArgTy = Context.IntTy;
- ((ParmVarDecl *)FTI.ArgInfo[i].Param)->setType(ArgTy);
+ Param->setType(ArgTy);
} else {
// Reject, but continue to parse 'float(const void)'.
if (ArgTy.getCVRQualifiers())