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

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 20 03:23:58 PDT 2018


ioeric added inline comments.


================
Comment at: include/clang/Basic/SourceManager.h:1533
 
+  /// Looks through all the local and imported source locations to find the set
+  /// of FileIDs that correspond to the given entry.
----------------
nit: put this closer to the closely related `translateFile`?


================
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;
----------------
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.


Repository:
  rC Clang

https://reviews.llvm.org/D50926





More information about the cfe-commits mailing list