diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2009-02-04 07:22:24 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2009-02-04 07:22:24 +0000 |
| commit | 6e3b7df125333ee7d1fbee853beddafda01c9e18 (patch) | |
| tree | 73a5b85cf51a0a353719c58f1a709b56a05f5656 /clang/lib | |
| parent | 0649abdfe2c44352a6518c2d2c1606e7bcbb7063 (diff) | |
| download | bcm5719-llvm-6e3b7df125333ee7d1fbee853beddafda01c9e18.tar.gz bcm5719-llvm-6e3b7df125333ee7d1fbee853beddafda01c9e18.zip | |
Handle demotion of coerced arguments (as in void a(x) short x; { ... }).
llvm-svn: 63726
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 8967ffbfc9b..2ad8f917e11 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1220,8 +1220,14 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, llvm::Value *V = CreateTempAlloca(ConvertType(Ty), "coerce"); CreateCoercedStore(AI, V, *this); // Match to what EmitParmDecl is expecting for this type. - if (!CodeGenFunction::hasAggregateLLVMType(Ty)) + if (!CodeGenFunction::hasAggregateLLVMType(Ty)) { V = Builder.CreateLoad(V); + if (!getContext().typesAreCompatible(Ty, Arg->getType())) { + // This must be a promotion, for something like + // "void a(x) short x; {..." + V = EmitScalarConversion(V, Ty, Arg->getType()); + } + } EmitParmDecl(*Arg, V); break; } |

