aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2015-09-08 09:18:30 +0000
committerJohn McCall <rjmccall@apple.com>2015-09-08 09:18:30 +0000
commit999110f903a9c43e817e459479f15ecc6bbc686d (patch)
tree85c60f982bc8395711c451f34b309bda442aa902 /clang/lib/CodeGen/CGDecl.cpp
parent808dfb8ba73f23230a5b11c6e35551b7c2fd7a52 (diff)
downloadllvm-999110f903a9c43e817e459479f15ecc6bbc686d.zip
llvm-999110f903a9c43e817e459479f15ecc6bbc686d.tar.gz
llvm-999110f903a9c43e817e459479f15ecc6bbc686d.tar.bz2
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
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index e4fe09c..57bec7f 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/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 (?).