<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 dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Paul,</div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">It is the 4th time in two weeks that you repost the exact same two emails, that’s a bit high repost rate for the mailing-list, especially considering that you already got answers that you ignored previously:</div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">- <a href="http://lists.llvm.org/pipermail/llvm-dev/2016-December/108060.html" class="">http://lists.llvm.org/pipermail/llvm-dev/2016-December/108060.html</a></div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">- <a href="http://lists.llvm.org/pipermail/llvm-dev/2016-December/108051.html" class="">http://lists.llvm.org/pipermail/llvm-dev/2016-December/108051.html</a></div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Adding an alternate email in case you didn’t receive previous emails.</div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><table class="vtop" style="border-collapse: collapse; border-spacing: 0px; padding: 0px; margin: 0px; border: none; color: rgb(0, 0, 0); font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 12px;"><tbody class=""><tr class=""><td style="margin: 0px; padding: 10px 1ex 0px 0px; text-align: justify; vertical-align: top;" class="">Best,</td></tr></tbody></table><div class=""><br class=""></div></div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">— </div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Mehdi</div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 21, 2016, at 2:47 AM, Paul Muntean via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I want to detect bad casts in C++ code by using the Clang<br class="">compiler. The approach is similar to what Caver and TypeSan do but<br class="">without using the compiler-rt.<br class=""><br class="">Caver and TypeSan:<br class=""><a href="https://www.usenix.org/system/files/conference/usenixsecurity15/sec15-paper-lee.pdf" class="">https://www.usenix.org/system/files/conference/usenixsecurity15/sec15-paper-lee.pdf</a><br class="">https://nebelwelt.net/publications/files/16CCS2.pdf<br class=""><br class="">For example if I have the following C++ code snippet where I want to<br class="">cast object b into<br class="">object D.<br class=""><br class="">D* obj = static_cast<D*>(b);<br class=""><br class="">from where (inside Clang, LTO, thinLTO, etc.) can I get the base class<br class="">of D and the base class ob b. Is this<br class="">available in the Clang compiler or LTO?<br class=""></div></div></blockquote><blockquote type="cite" class=""><div class=""><div class=""><br class="">Also, if b is an object of a virtual Class (class with inherited or its<br class="">own virtual functions) can I get its virtual pointer at compile time<br class="">by using the LTO?<br class=""><br class="">I found out that in CodeGen/CGExpr.cpp the explicit case "BaseToDerived" is<br class="">handled and you can retrieve TypeSourceInfo using the function<br class="">getTypeInfoAsWritten(). It seems that this information is enough to get<br class="">the exact type of this cast at compile-time and should also work for<br class="">Template programming, as my, understanding is that Clang should have<br class="">abstracted the code into, specific types at this point.<br class=""><br class="">Am I wrong here?<br class=""><br class="">Is there any case where the type of the objects used inside the cast<br class="">not known at compile time? Can the,<br class="">'real' type be hidden behind a pointer?<br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></div></blockquote></div><br class=""></div></div></body></html>