================
@@ -312,6 +317,16 @@ struct SymbolInfo : public Info {
 
   std::optional<Location> DefLoc;     // Location where this decl is defined.
   llvm::SmallVector<Location, 2> Loc; // Locations where this decl is declared.
+
+  bool operator<(const SymbolInfo &Other) const {
+    if (DefLoc && Other.DefLoc) {
+      return *DefLoc < *Other.DefLoc;
+    }
+    if (Loc.size() > 0 && Other.Loc.size() > 0) {
+      return Loc[0] < Other.Loc[0];
+    }
+    return extractName() < Other.extractName();
+  }
----------------
PeterChou1 wrote:

I changed the logic up a bit, now it works by sorting by declaration location, 
location then name, I also added some comments explaining my logic

https://github.com/llvm/llvm-project/pull/101387
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to