diff options
| author | Nico Weber <nicolasweber@gmx.de> | 2018-03-07 02:22:41 +0000 |
|---|---|---|
| committer | Nico Weber <nicolasweber@gmx.de> | 2018-03-07 02:22:41 +0000 |
| commit | bbf648253d096b4e25f588583df8ed8e764a28bb (patch) | |
| tree | 0b02e45d28db415c8f5fa00795969510f93c1fd0 /clang/lib/CodeGen | |
| parent | 204ade4102c7959cc56e03f163ad7473c94a0b38 (diff) | |
| download | bcm5719-llvm-bbf648253d096b4e25f588583df8ed8e764a28bb.tar.gz bcm5719-llvm-bbf648253d096b4e25f588583df8ed8e764a28bb.zip | |
Revert r326602, it caused PR36620.
llvm-svn: 326862
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 187697ee0b6..48841b564e4 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -1847,9 +1847,10 @@ void CodeGenModule::ConstructAttributeList( HasOptnone = TargetDecl->hasAttr<OptimizeNoneAttr>(); if (auto *AllocSize = TargetDecl->getAttr<AllocSizeAttr>()) { Optional<unsigned> NumElemsParam; - if (AllocSize->numElemsParam().isValid()) - NumElemsParam = AllocSize->numElemsParam().getLLVMIndex(); - FuncAttrs.addAllocSizeAttr(AllocSize->elemSizeParam().getLLVMIndex(), + // alloc_size args are base-1, 0 means not present. + if (unsigned N = AllocSize->getNumElemsParam()) + NumElemsParam = N - 1; + FuncAttrs.addAllocSizeAttr(AllocSize->getElemSizeParam() - 1, NumElemsParam); } } @@ -4392,7 +4393,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, OffsetValue); } else if (const auto *AA = TargetDecl->getAttr<AllocAlignAttr>()) { llvm::Value *ParamVal = - CallArgs[AA->paramIndex().getLLVMIndex()].RV.getScalarVal(); + CallArgs[AA->getParamIndex() - 1].RV.getScalarVal(); EmitAlignmentAssumption(Ret.getScalarVal(), ParamVal); } } |

