[PATCH] D112608: [clangd] IncludeCleaner: Do not process locations in built-in files
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 27 02:36:51 PDT 2021
kbobyrev created this revision.
kbobyrev added a reviewer: sammccall.
Herald added subscribers: usaxena95, arphaman.
kbobyrev requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.
Doing otherwise leads to crashing. Way to reproduce: open "gmock/gmock.h" in
the LLVM source tree.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D112608
Files:
clang-tools-extra/clangd/IncludeCleaner.cpp
Index: clang-tools-extra/clangd/IncludeCleaner.cpp
===================================================================
--- clang-tools-extra/clangd/IncludeCleaner.cpp
+++ clang-tools-extra/clangd/IncludeCleaner.cpp
@@ -133,7 +133,7 @@
void add(SourceLocation Loc) { add(SM.getFileID(Loc), Loc); }
void add(FileID FID, SourceLocation Loc) {
- if (FID.isInvalid())
+ if (FID.isInvalid() || SM.isWrittenInBuiltinFile(Loc))
return;
assert(SM.isInFileID(Loc, FID));
if (Loc.isFileID()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112608.382572.patch
Type: text/x-patch
Size: 514 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211027/5c208b77/attachment.bin>
More information about the cfe-commits
mailing list