diff options
author | John McCall <rjmccall@apple.com> | 2015-09-08 09:18:30 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2015-09-08 09:18:30 +0000 |
commit | 999110f903a9c43e817e459479f15ecc6bbc686d (patch) | |
tree | 85c60f982bc8395711c451f34b309bda442aa902 /clang/lib/CodeGen/CGDecl.cpp | |
parent | 808dfb8ba73f23230a5b11c6e35551b7c2fd7a52 (diff) | |
download | llvm-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.cpp | 6 |
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 (?). |