From: John McCall Date: Tue, 8 Sep 2015 09:18:30 +0000 (+0000) Subject: When building the alloca for a local variable, set its name X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c7681e6d9fcd285a93da34ad795a89ee58a754b4;p=clang When building the alloca for a local variable, set its name separately from building the instruction so that it's preserved even in -Asserts builds. Employ C++'s mystical "comment" feature to discourage breaking this in the future. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246991 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index e4fe09c435..57bec7f472 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/lib/CodeGen/CGDecl.cpp @@ -968,7 +968,11 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) { allocaAlignment = alignment; } - address = CreateTempAlloca(allocaTy, allocaAlignment, D.getName()); + // Create the alloca. Note that we set the name separately from + // building the instruction so that it's there even in no-asserts + // builds. + address = CreateTempAlloca(allocaTy, allocaAlignment); + address.getPointer()->setName(D.getName()); // Emit a lifetime intrinsic if meaningful. There's no point // in doing this if we don't have a valid insertion point (?).