[PATCH] D64915: [clangd] cleanup: unify the implemenation of checking a location is inside main file.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 18 07:59:49 PDT 2019
hokein added inline comments.
================
Comment at: clang-tools-extra/clangd/SourceCode.cpp:332
+bool isInsideMainFile(SourceLocation Loc, const SourceManager &SM) {
+ return Loc.isValid() && SM.isWrittenInMainFile(SM.getFileLoc(Loc));
+}
----------------
ilya-biryukov wrote:
> NIT: why not `getExpansionLoc`? Its implementation and description seems simpler and (I believe) it produces locations inside the same files as `getFileLoc` (as both the macro arg and the macro name of the expansion are always coming from the same file)
yes, since we are checking the file (not the range), there is no difference between these two methods. Changed to `getExpansionLoc`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64915/new/
https://reviews.llvm.org/D64915
More information about the cfe-commits
mailing list