[PATCH] D19271: Change CALL_ONCE_INITIALIZATION implementation to use static initialization

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 16:53:08 PDT 2016


kcc added inline comments.

================
Comment at: include/llvm/PassSupport.h:35
@@ +34,3 @@
+#define CALL_ONCE_INITIALIZATION(function)                                     \
+  static bool init_once([&] {                                                  \
+    function(Registry);                                                        \
----------------
kcc wrote:
> Mmm. I am probably missing something trivial (c++11-ish), but how is this going to work?
> For me it looks like you define a static bool function, but never call it. 
Aaaah, init_once is a bool variable, not a function. Oh, how much this is confusing... 
Will this work with the versions of Visual C++ we use for LLVM? 
I remember that static initialization was broken there (until recently?)

Why not std::call_once? 


http://reviews.llvm.org/D19271





More information about the llvm-commits mailing list