[llvm-dev] "Do not use Static Constructors" LLVM Coding Standard rule question

valery pykhtin via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 8 22:52:41 PST 2016


Hi,

I'm new here and have a question about the rule in title. Is the following
use case also prohibited?

int findNameId(StringRef Name)
{
   static StringMap<int> Map = createSomeIDMap();
   return Map.lookup(Name);
};

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.

I'm asking because under some interpretation of rule wording it can be
called static constructor too.

Thanks,
Valery
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160309/a4715848/attachment.html>


More information about the llvm-dev mailing list