[PATCH] D123784: [clang][analyzer][ctu] Traverse the ctu CallEnter nodes in reverse order

Bal√°zs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 19 02:30:53 PDT 2022

steakhal added inline comments.

Comment at: clang/lib/StaticAnalyzer/Core/WorkList.cpp:204-207
   // Compare by number of times the location was visited first (negated
   // to prefer less often visited locations), then by insertion time (prefer
   // expanding nodes inserted sooner first).
+  using QueuePriority = std::pair<int, long>;
Please leave a note there, of what the negative values are used for.

Comment at: clang/lib/StaticAnalyzer/Core/WorkList.cpp:216-218
   // Number of inserted nodes, used to emulate DFS ordering in the priority
   // queue when insertions are equal.
+  long Counter = 0;
It seems like you are not exploiting the signedness of this variable. And a counter should never be negative anyway.

Comment at: clang/lib/StaticAnalyzer/Core/WorkList.cpp:255
+class CTUWorkList : public UnexploredFirstPriorityQueue {
+  enum class SecondaryOrder { DFS = 1, ReverseDFS };
+  SecondaryOrder ScndOrd = SecondaryOrder::ReverseDFS;
Raw enum would make it more convenient, and the scope is already private - thus it won't affect readability elsewhere.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list