From ef915aab0ac566c55bfb0d7a9f6635bb5d94d4af Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 26 Jun 2017 20:33:12 +0000 Subject: Vendor import of clang trunk r306325: https://llvm.org/svn/llvm-project/cfe/trunk@306325 --- lib/CodeGen/CodeGenFunction.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/CodeGenFunction.cpp') diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index ac1a1334f103..93a4a3866193 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -860,6 +860,13 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, Builder.SetInsertPoint(EntryBB); + // If we're checking the return value, allocate space for a pointer to a + // precise source location of the checked return statement. + if (requiresReturnValueCheck()) { + ReturnLocation = CreateDefaultAlignTempAlloca(Int8PtrTy, "return.sloc.ptr"); + InitTempAlloca(ReturnLocation, llvm::ConstantPointerNull::get(Int8PtrTy)); + } + // Emit subprogram debug descriptor. if (CGDebugInfo *DI = getDebugInfo()) { // Reconstruct the type from the argument list so that implicit parameters, @@ -887,8 +894,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, if (CGM.getCodeGenOpts().InstrumentForProfiling) { if (CGM.getCodeGenOpts().CallFEntry) Fn->addFnAttr("fentry-call", "true"); - else - Fn->addFnAttr("counting-function", getTarget().getMCountName()); + else { + if (!CurFuncDecl || !CurFuncDecl->hasAttr()) + Fn->addFnAttr("counting-function", getTarget().getMCountName()); + } } if (RetTy->isVoidType()) { -- cgit v1.2.3