[PATCH] D66122: [CodeGen] Emit dynamic initializers for static TLS vars in outlined scopes

Princeton Ferro via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 20 16:10:20 PDT 2019


Prince781 marked an inline comment as done.
Prince781 added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:479
+        return a_deps.find(b) != a_deps.end() 
+            || b->getLocation() < a->getLocation(); // ensure deterministic ordering
+      });
----------------
efriedma wrote:
> Is the call to a_deps.find() here actually necessary?  It shouldn't be possible for an initializer to directly refer to a variable declared later.
> 
> "<" on SourceLocations isn't source order, in general; you need isBeforeInTranslationUnit.  (This should be documented somewhere, but I'm not finding the documentation, unfortunately.  Any suggestions for where it should be documented?)
> It shouldn't be possible for an initializer to directly refer to a variable declared later.

That's true. I was using `deps.find()` to order the initialization of the variables. But since you mention `isBeforeInTranslationUnit`, I can use that instead. It appears to be documented [[ https://clang.llvm.org/doxygen/classclang_1_1SourceManager.html#af0ffe5c3a34c93204accb74f0f4717c5 | here ]].


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66122/new/

https://reviews.llvm.org/D66122





More information about the cfe-commits mailing list