<div class="gmail_quote">On Tue, Feb 7, 2012 at 10:01 AM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Kostya,<br>
<br>
One unexpected piece of fallout in your recent attributes change (r148553) was that it introduced a bunch of static constructors into .o files that #include Attributes.h, due to stuff like this:<br>
<br>
const Attributes None      (0);     ///< No attributes have been set<br>
const Attributes ZExt      (1<<0);  ///< Zero extended before/after call<br>
const Attributes SExt      (1<<1);  ///< Sign extended before/after call<br>
const Attributes NoReturn  (1<<2);  ///< Mark the function as not returning<br>
<br>
We really don't like static ctors in LLVM, because it is often used as a library, and they cause startup-time performance hits and other bad news.  I'm surprised we don't have an explicit section about it in the CodingStandards, but we do have:<br>

<a href="http://llvm.org/docs/CodingStandards.html#ll_iostream" target="_blank">http://llvm.org/docs/CodingStandards.html#ll_iostream</a><br>
<br>
... which talks about the same thing.<br>
<br>
Anyway, as it turns out, LLVM can optimize those static ctors away in some cases, but not all (e.g. -O0).  This was found because LLDB builds with -Wstatic-constructor and this header change is causing a flood of warnings.<br>

<br>
<br>
I can think of two ways to fix this.  One is to replace all of these with "get" functions, which would be really really ugly.  A better change would be to replace these with enums, eliminating the whole problem.  Are 64-bit enums portable enough to be used here?</blockquote>
<div><br></div><div>I know Kostya and others are looking at this, but I have to say: why-oh-why can't we have constexpr! ;] *This* is the problem those were meant to solve, and they actually seem to solve it.... ahh well... </div>
</div>