[PATCH] Fix for http://llvm.org/PR23392: magick/feature.c from ImageMagick-6.9.1-2 ICEs
Alexey Bataev
a.bataev at hotmail.com
Wed May 6 05:02:49 PDT 2015
Hi rjmccall,
Fix for codegen of static variables declared inside of captured statements. Captured statements are actually a transparent DeclContexts, so we have to skip them when trying to get a mangled name for statics.
http://reviews.llvm.org/D9522
Files:
lib/CodeGen/CGDecl.cpp
test/CodeGen/captured-statements.c
Index: test/CodeGen/captured-statements.c
===================================================================
--- test/CodeGen/captured-statements.c
+++ test/CodeGen/captured-statements.c
@@ -14,6 +14,8 @@
int i = 0;
#pragma clang __debug captured
{
+ static int inner;
+ (void)inner;
i++;
}
// CHECK-1: %struct.anon = type { i32* }
Index: lib/CodeGen/CGDecl.cpp
===================================================================
--- lib/CodeGen/CGDecl.cpp
+++ lib/CodeGen/CGDecl.cpp
@@ -156,6 +156,8 @@
assert(!D.isExternallyVisible() && "name shouldn't matter");
std::string ContextName;
const DeclContext *DC = D.getDeclContext();
+ if (auto *CD = dyn_cast<CapturedDecl>(DC))
+ DC = cast<DeclContext>(CD->getNonClosureContext());
if (const auto *FD = dyn_cast<FunctionDecl>(DC))
ContextName = CGM.getMangledName(FD);
else if (const auto *BD = dyn_cast<BlockDecl>(DC))
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9522.25036.patch
Type: text/x-patch
Size: 922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150506/ebc52053/attachment.bin>
More information about the cfe-commits
mailing list