efriedma 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
+      });
----------------
Prince781 wrote:
> 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 ]].
The documentation question was more referring to the lack of documentation for 
operator< on SourceLocation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66122



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to