<div dir="ltr">I believe the rule is only for global variables. At least that's what the first sentence in the section says.<div><br></div><div><span style="color:rgb(0,0,0);font-family:'Lucida Grande','Lucida Sans Unicode',Geneva,Verdana,sans-serif;font-size:14px;line-height:21px">"Static constructors and destructors (e.g. global variables whose types have a constructor or destructor) should not be added to the code base, and should be removed wherever possible."</span><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 8, 2016 at 10:52 PM, valery pykhtin via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I'm new here and have a question about the rule in title. Is the following use case also prohibited?</div><div><br></div><div>int findNameId(StringRef Name)</div><div>{</div><div>   static StringMap<int> Map = createSomeIDMap();</div><div>   return Map.lookup(Name);</div><div>};</div><div><br></div><div>It seems it isn't influence startup time and doesn't create initialization order problems. Clang isn't complaining about it with -Wglobal-constructor flag.</div><div><br></div><div>I'm asking because under some interpretation of rule wording it can be called static constructor too.</div><div><br></div><div>Thanks,</div><div>Valery</div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">~Craig</div>
</div>