]> granicus.if.org Git - clang/commitdiff
When building the alloca for a local variable, set its name
authorJohn McCall <rjmccall@apple.com>
Tue, 8 Sep 2015 09:18:30 +0000 (09:18 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 8 Sep 2015 09:18:30 +0000 (09:18 +0000)
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

lib/CodeGen/CGDecl.cpp

index e4fe09c435b183c06f9d8dc957f08c3a1e88e5ec..57bec7f472763754ab78a094ba98507a5f7bf577 100644 (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 (?).