Promote null pointer constants used as arguments to variadic functions

Make it possible to pass NULL through variadic functions on 64-bit
Windows targets. The Visual C++ headers define NULL to 0, when they
should define it to 0LL on Win64 so that NULL is a pointer-sized
integer.

Fixes PR20949.

Reviewers: thakis, rsmith

Differential Revision: http://reviews.llvm.org/D5480

llvm-svn: 219456
This commit is contained in:
Reid Kleckner
2014-10-10 00:05:45 +00:00
parent df782e4229
commit 79b0fd7a48
3 changed files with 43 additions and 1 deletions

View File

@@ -2752,7 +2752,7 @@ public:
// If we still have any arguments, emit them using the type of the argument.
for (; Arg != ArgEnd; ++Arg)
ArgTypes.push_back(Arg->getType());
ArgTypes.push_back(getVarArgType(*Arg));
EmitCallArgs(Args, ArgTypes, ArgBeg, ArgEnd, CalleeDecl, ParamsToSkip,
ForceColumnInfo);
@@ -2765,6 +2765,8 @@ public:
unsigned ParamsToSkip = 0, bool ForceColumnInfo = false);
private:
QualType getVarArgType(const Expr *Arg);
const TargetCodeGenInfo &getTargetHooks() const {
return CGM.getTargetCodeGenInfo();
}