<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class="">On Oct 12, 2015, at 10:50 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><div class=""><div dir="ltr" class="">+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.</div></div></blockquote><div><br class=""></div><div>The functionality looks fine to me; I definitely just overlooked the debug-info side of things.</div><div><br class=""></div><div>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.</div><div><br class=""></div><div>John.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Sun, Oct 11, 2015 at 11:09 PM, Bataev, Alexey <span dir="ltr" class=""><<a href="mailto:a.bataev@hotmail.com" target="_blank" class="">a.bataev@hotmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes, revision 246985 <<a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?diff_format=h&revision=246985&view=markup" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?diff_format=h&revision=246985&view=markup</a>> broke th debug info for types in explicit casts.<br class="">
<br class="">
Best regards,<br class="">
Alexey Bataev<br class="">
=============<br class="">
Software Engineer<br class="">
Intel Compiler Team<br class="">
<br class="">
09.10.2015 18:26, David Blaikie пишет:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><div class="h5">
<br class="">
<br class="">
On Fri, Oct 9, 2015 at 2:26 AM, Alexey Bataev via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a> <mailto:<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>>> wrote:<br class="">
<br class="">
    ABataev created this revision.<br class="">
    ABataev added a reviewer: echristo.<br class="">
    ABataev added a subscriber: cfe-commits.<br class="">
<br class="">
    Currently debug info for types used in explicit cast only is not<br class="">
    emitted. It happened after a patch for better alignment handling.<br class="">
<br class="">
<br class="">
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)?<br class="">
<br class="">
    This patch fixes this bug.<br class="">
<br class="">
    <a href="http://reviews.llvm.org/D13582" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D13582</a><br class="">
<br class="">
    Files:<br class="">
      lib/CodeGen/CGExpr.cpp<br class="">
      test/CodeGenCXX/debug-info-explicit-cast.cpp<br class="">
<br class="">
    Index: lib/CodeGen/CGExpr.cpp<br class="">
    ===================================================================<br class="">
    --- lib/CodeGen/CGExpr.cpp<br class="">
    +++ lib/CodeGen/CGExpr.cpp<br class="">
    @@ -799,6 +799,10 @@<br class="">
         if (E->getType()->isVariablyModifiedType())<br class="">
           EmitVariablyModifiedType(E->getType());<br class="">
<br class="">
    +    if (isa<ExplicitCastExpr>(CE))<br class="">
    +      if (CGDebugInfo *DI = getDebugInfo())<br class="">
    +        DI->EmitExplicitCastType(E->getType());<br class="">
    +<br class="">
         switch (CE->getCastKind()) {<br class="">
         // Non-converting casts (but not C's implicit conversion from<br class="">
    void*).<br class="">
         case CK_BitCast:<br class="">
    Index: test/CodeGenCXX/debug-info-explicit-cast.cpp<br class="">
    ===================================================================<br class="">
    --- test/CodeGenCXX/debug-info-explicit-cast.cpp<br class="">
    +++ test/CodeGenCXX/debug-info-explicit-cast.cpp<br class="">
    @@ -0,0 +1,18 @@<br class="">
    +// RUN: %clangxx -c -target x86_64-unknown-unknown -g %s<br class="">
    -emit-llvm -S -o - | FileCheck %s<br class="">
    +struct Foo {<br class="">
    +  int a;<br class="">
    +  Foo() : a(1){};<br class="">
    +};<br class="">
    +<br class="">
    +struct Bar {<br class="">
    +  int b;<br class="">
    +  Bar() : b(2){};<br class="">
    +};<br class="">
    +<br class="">
    +int main() {<br class="">
    +  Bar *pb = new Bar;<br class="">
    +<br class="">
    +  return reinterpret_cast<Foo *>(pb)->a;<br class="">
    +}<br class="">
    +<br class="">
    +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Foo",<br class="">
<br class="">
<br class="">
<br class="">
    _______________________________________________<br class="">
    cfe-commits mailing list<br class=""></div></div>
    <a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a> <mailto:<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>><br class="">
    <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class="">
<br class="">
<br class="">
</blockquote>
<br class="">
</blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>