summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp9
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);
}
}
OpenPOWER on IntegriCloud