[PATCH] D69844: [Basic] Integrate SourceLocation and SourceRange with FoldingSet, NFCI

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 19 14:30:42 PDT 2020


dexonsmith requested changes to this revision.
dexonsmith added a reviewer: dexonsmith.
dexonsmith added inline comments.


================
Comment at: clang/include/clang/Basic/SourceLocation.h:184-185
 
+  /// Write this source location to a FoldingSetNodeID
+  void Profile(llvm::FoldingSetNodeID &Node) const;
+
----------------
Seems a bit strange to me to add `SourceLocation::Profile`. Is there another hook available for `FoldingSet` that works with free functions, or template specializations? You could make that hook a friend in order to give it access to the internals. Or can the caller just use `getHashValue()`?


================
Comment at: clang/include/clang/Basic/SourceLocation.h:247-249
+  /// Write this source range to a FoldingSetNodeID
+  void Profile(llvm::FoldingSetNodeID &Node) const;
+
----------------
I'm not sure you need this change since you don't need to give access to internals here.


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

https://reviews.llvm.org/D69844



More information about the cfe-commits mailing list