[PATCH] D155614: [clangd] Make an include always refer to itself. Background: clang-review expects all referents to have definition, declaration or reference(s).

Viktoriia Bakalova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 08:48:36 PDT 2023


VitaNuo created this revision.
Herald added subscribers: kadircet, arphaman.
Herald added a project: All.
VitaNuo requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155614

Files:
  clang-tools-extra/clangd/XRefs.cpp


Index: clang-tools-extra/clangd/XRefs.cpp
===================================================================
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1358,18 +1358,13 @@
         Result.Loc.uri = URIMainFile;
         Results.References.push_back(std::move(Result));
       });
-  if (Results.References.empty())
-    return std::nullopt;
-
+ 
   // Add the #include line to the references list.
   ReferencesResult::Reference Result;
   Result.Loc.range =
       rangeTillEOL(SM.getBufferData(SM.getMainFileID()), Inc.HashOffset);
   Result.Loc.uri = URIMainFile;
   Results.References.push_back(std::move(Result));
-
-  if (Results.References.empty())
-    return std::nullopt;
   return Results;
 }
 } // namespace


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155614.541576.patch
Type: text/x-patch
Size: 760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230718/51bec60f/attachment.bin>


More information about the cfe-commits mailing list