[PATCH] D98225: [flang] Sort symbols by creation order

Tim Keith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 9 06:49:09 PST 2021


tskeith added inline comments.


================
Comment at: flang/include/flang/Semantics/symbol.h:599
   bool operator<(const Symbol &that) const {
-    // For maps of symbols: collate them by source location
-    return name_.begin() < that.name_.begin();
+    // For maps of symbols: collate them by creation order
+    return sortIndex_ < that.sortIndex_;
----------------
There isn't anything specific to maps about this so I think the comment just "collate symbols by creation order".


================
Comment at: flang/include/flang/Semantics/symbol.h:658
+  std::size_t sortIndex_; // to implement "operator<" platform independently
+  static std::size_t nameCount_;
   Attrs attrs_;
----------------
It would make more sense to put `nameCount_` in `Symbols`. And `symbolCount_` would be a better name.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98225



More information about the llvm-commits mailing list