[PATCH] D79834: Speed up preamble building by replacing the slow translateFile call by a new, faster isMainFile check
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 14 13:03:55 PDT 2020
dexonsmith added inline comments.
================
Comment at: clang/lib/Basic/SourceManager.cpp:397
+ return false;
+ return FE->getUID() == SourceFile.getUID();
+}
----------------
arphaman wrote:
> jkorous wrote:
> > I don't really understand all the details here but shouldn't we use this comparison?
> > ```
> > bool operator==(const FileEntryRef &LHS, const FileEntryRef &RHS)
> > ```
> The `==` comparison can return false for symlinks due to the different name, but we want to return true for symlinks to the main file as well.
I suggest adding a comment to the code explaining this when you land it, something like:
// Compare UIDs directly so that symlinks compare equal.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79834/new/
https://reviews.llvm.org/D79834
More information about the cfe-commits
mailing list