[PATCH] D50926: [SourceManager] Extract 'findFileIDsForFile' from 'translateFile' to allow mapping from one file entry to multiple FileIDs

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 20 10:17:02 PDT 2018


arphaman added inline comments.


================
Comment at: include/clang/Basic/SourceManager.h:1539
+  /// \returns true if the callback returned true, false otherwise.
+  bool findFileIDsForFile(const FileEntry *SourceFile,
+                          llvm::function_ref<bool(FileID)> Callback) const;
----------------
ioeric wrote:
> Callback pattern seems uncommon in LLVM/Clang. I'd suggest making this return a set of `FileID`s and put the callback-based function as a helper (shared by this and `translateFile`)in the implementation.
I created a helper, but unfortunately it needs to be a member of SourceManager as FileID::get is private.


Repository:
  rC Clang

https://reviews.llvm.org/D50926





More information about the cfe-commits mailing list