[PATCH] D28166: Properly merge K&R functions that have attributes

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 3 13:19:38 PST 2017


rnk added inline comments.


================
Comment at: lib/CodeGen/CodeGenFunction.h:3570
     for (auto *A : llvm::make_range(Arg, ArgRange.end()))
-      ArgTypes.push_back(getVarArgType(A));
+      ArgTypes.push_back(getVarArgType(A, CallArgTypeInfo == nullptr));
 
----------------
rnk wrote:
> I'm testing this change:
> ```
> $ git diff
> diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
> index acf8863..2662ebb 100644
> --- a/lib/CodeGen/CodeGenFunction.h
> +++ b/lib/CodeGen/CodeGenFunction.h
> @@ -3571,7 +3571,8 @@ public:
> 
>      // If we still have any arguments, emit them using the type of the argument.
>      for (auto *A : llvm::make_range(Arg, ArgRange.end()))
> -      ArgTypes.push_back(getVarArgType(A));
> +      ArgTypes.push_back(CalleeDecl->isVariadic() ? getVarArgType(A)
> +                                                  : A->getType());
> 
>      EmitCallArgs(Args, ArgTypes, ArgRange, CalleeDecl, ParamsToSkip, Order);
>    }
> 
> ```
> 
> I'd like to fix this issue in a separate commit.
So, that didn't work at all, but the gist of it is that I don't think we should call a function like `getVarArgType` when we aren't lowering a variadic function call. I'll look into doing it.


https://reviews.llvm.org/D28166





More information about the cfe-commits mailing list