<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Chandler,<br>
<br>
Could you elaborate on "there is usually a better pattern to follow"?<br>
<br>
I don't like the casts either and would prefer another way.<br>
<br>
Jack<br>
<div style=""><br>
</div>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF407642"><font face="Tahoma" color="#000000" size="2"><b>From:</b> Chandler Carruth [chandlerc@google.com]<br>
<b>Sent:</b> Thursday, January 31, 2013 3:46 PM<br>
<b>To:</b> Carter, Jack<br>
<b>Cc:</b> Commit Messages and Patches for LLVM<br>
<b>Subject:</b> Re: [llvm] r173885 - This patch implements runtime ARM specific</font><br>
</div>
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
     // Not in an ITBlock to start with.<br>
     ITState.CurPosition = ~0U;<br>
+<br>
+    // Set ELF header flags.<br>
+    // FIXME: This should eventually end up somewhere else where more<br>
+    // intelligent flag decisions can be made. For now we are just maintaining<br>
+    // the status quo for ARM and setting EF_ARM_EABI_VER5 as the default.<br>
+    MCELFStreamer &MES = static_cast<MCELFStreamer &>(Parser.getStreamer());<br>
+    MES.getAssembler().setELFHeaderEFlags(ELF::EF_ARM_EABI_VER5);<br>
</blockquote>
<div><br>
</div>
<div style="">Here, you don't test or check anything, you simply cast to MCELFStreamer, and run. This caused *really* strange bugs. I've fixed it in r174118 to use a proper check on the type of the MCStreamer here, but I would encourage you to audit some of
 the other changes in this area to make sure there aren't other instances of this bug.</div>
<div style=""><br>
</div>
<div style="">In general, any use of static_cast<> to move through a dynamic class hierarchy in LLVM is pretty suspect, and something to investigate as there is usually a better pattern to follow.</div>
<div style=""><br>
</div>
<div style="">-Chandler</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>