[PATCH] D65196: [CFG] Introduce CFGElementRef, a wrapper that knows it's position in a CFGBlock

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 24 16:28:09 PDT 2019


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Oof.

Someone had to do it.



================
Comment at: clang/include/clang/Analysis/CFG.h:617
+  template <bool IsConst>
+  class ElementRef {
+
----------------
Yeah, kinda shocking that you needed to go that far >.<

I suggest `CFGElementRefBase` or `CFGElementRefImpl` or something like that, because otherwise it looks to me as if it's some sort of a generic reference to an element of arbitrary collection.


================
Comment at: clang/include/clang/Analysis/CFG.h:648-650
+      if (Parent == Other.Parent)
+        return Index < Other.Index;
+      return Parent < Other.Parent;
----------------
For lexicographic comparisons i personally enjoy `std::make_pair(Parent, Index) < std::make_pair(Other.Parent, Other.Index)`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65196





More information about the cfe-commits mailing list