[PATCH] D13582: [DEBUG INFO] Emit debug info for type used in explicit cast only.
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 12 13:17:34 PDT 2015
> On Oct 12, 2015, at 10:50 AM, David Blaikie <dblaikie at gmail.com> wrote:
> +John, author of the original patch - in case it's an obvious mistake. I haven't looked at John's change yet & compared it to the intended behavior, etc. Will do so soon and/or if John doesn't see something at a glance.
The functionality looks fine to me; I definitely just overlooked the debug-info side of things.
Let’s extract out a function to emit the cast type of an explicit cast and make sure we call it consistently. It can do both the VLA binding and the debug-info emission.
John.
>
> On Sun, Oct 11, 2015 at 11:09 PM, Bataev, Alexey <a.bataev at hotmail.com <mailto:a.bataev at hotmail.com>> wrote:
> Yes, revision 246985 <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?diff_format=h&revision=246985&view=markup <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?diff_format=h&revision=246985&view=markup>> broke th debug info for types in explicit casts.
>
> Best regards,
> Alexey Bataev
> =============
> Software Engineer
> Intel Compiler Team
>
> 09.10.2015 18:26, David Blaikie пишет:
>
>
> On Fri, Oct 9, 2015 at 2:26 AM, Alexey Bataev via cfe-commits <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org> <mailto:cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>>> wrote:
>
> ABataev created this revision.
> ABataev added a reviewer: echristo.
> ABataev added a subscriber: cfe-commits.
>
> Currently debug info for types used in explicit cast only is not
> emitted. It happened after a patch for better alignment handling.
>
>
> You mean a patch related to alignment regressed this functionality? Do you have the specific revision number of that change (since it sounds like you tracked it down)?
>
> This patch fixes this bug.
>
> http://reviews.llvm.org/D13582 <http://reviews.llvm.org/D13582>
>
> Files:
> lib/CodeGen/CGExpr.cpp
> test/CodeGenCXX/debug-info-explicit-cast.cpp
>
> Index: lib/CodeGen/CGExpr.cpp
> ===================================================================
> --- lib/CodeGen/CGExpr.cpp
> +++ lib/CodeGen/CGExpr.cpp
> @@ -799,6 +799,10 @@
> if (E->getType()->isVariablyModifiedType())
> EmitVariablyModifiedType(E->getType());
>
> + if (isa<ExplicitCastExpr>(CE))
> + if (CGDebugInfo *DI = getDebugInfo())
> + DI->EmitExplicitCastType(E->getType());
> +
> switch (CE->getCastKind()) {
> // Non-converting casts (but not C's implicit conversion from
> void*).
> case CK_BitCast:
> Index: test/CodeGenCXX/debug-info-explicit-cast.cpp
> ===================================================================
> --- test/CodeGenCXX/debug-info-explicit-cast.cpp
> +++ test/CodeGenCXX/debug-info-explicit-cast.cpp
> @@ -0,0 +1,18 @@
> +// RUN: %clangxx -c -target x86_64-unknown-unknown -g %s
> -emit-llvm -S -o - | FileCheck %s
> +struct Foo {
> + int a;
> + Foo() : a(1){};
> +};
> +
> +struct Bar {
> + int b;
> + Bar() : b(2){};
> +};
> +
> +int main() {
> + Bar *pb = new Bar;
> +
> + return reinterpret_cast<Foo *>(pb)->a;
> +}
> +
> +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Foo",
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org> <mailto:cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151012/eac7fa3a/attachment-0001.html>
More information about the cfe-commits
mailing list