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.

llvm-svn: 246991
This commit is contained in:
John McCall 2015-09-08 09:18:30 +00:00
parent 808dfb8ba7
commit 999110f903
1 changed files with 5 additions and 1 deletions

View File

@ -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 (?).