r246991 - When building the alloca for a local variable, set its name

John McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 8 02:18:31 PDT 2015


Author: rjmccall
Date: Tue Sep  8 04:18:30 2015
New Revision: 246991

URL: http://llvm.org/viewvc/llvm-project?rev=246991&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/CodeGen/CGDecl.cpp

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=246991&r1=246990&r2=246991&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Tue Sep  8 04:18:30 2015
@@ -968,7 +968,11 @@ CodeGenFunction::EmitAutoVarAlloca(const
         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 (?).




More information about the cfe-commits mailing list