[PATCH] D128821: [clangd][ObjC] Fix ObjC method definition completion

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 07:34:19 PDT 2022


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Ah, this is subtle. Thanks!



================
Comment at: clang-tools-extra/clangd/CodeComplete.cpp:866
     case CodeCompletionResult::RK_Pattern:
-      return Result.Pattern->getTypedText();
+      CCS = Result.Pattern;
+      break;
----------------
weirdly, codeCompletionString(Result) looks like it would mutate Result and then return a pattern with the same chunks (but different extra fields). So not affect the result of this function, but possibly others as a side-effect.

(e.g. add BriefComment and ParentName in the case that there's a pattern + declaration, as there is here)

What you have is fine, but if you feel like digging deeper codeCompletionString(Result) may be either better or worse here!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128821/new/

https://reviews.llvm.org/D128821



More information about the cfe-commits mailing list