This is an archive of the discontinued LLVM Phabricator instance.

[Sema][CodeComplete][ObjC] Don't include arrow/dot fixits
ClosedPublic

Authored by dgoldman on Jun 5 2020, 8:03 AM.

Details

Summary

Exempt ObjC from arrow/dot fixits since this has limited value for
Objective-C, where properties (referenced by dot syntax) are normally
backed by ivars (referenced by arrow syntax).

In addition, the current implementation doesn't properly mark
the fix it condition for Objective-C.

This was initially added in https://reviews.llvm.org/D41537
for C++ and then later C, don't believe the Objective-C changes
were intentional.

Diff Detail

Event Timeline

dgoldman created this revision.Jun 5 2020, 8:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2020, 8:03 AM
dgoldman updated this revision to Diff 268803.Jun 5 2020, 8:10 AM
  • Fix test run line
dgoldman updated this revision to Diff 268818.Jun 5 2020, 8:34 AM
  • Fix broken diff base (due to lint fixes maybe?)
yvvan added a comment.Jun 8 2020, 1:18 AM

I'm not a big objC expert here. The idea looks fine to me and won't affect my workflow. So let's take this patch if nobody comments against it here.

sammccall accepted this revision.Jun 8 2020, 1:29 AM
sammccall added inline comments.
clang/lib/Sema/SemaCodeComplete.cpp
5153

IncludeObjC is always !AccessOpFixIt.hasValue() - use that directly with a suitable comment?

5255

This first sentence isn't accurate - they're included for C, and even in obj-c, just not for obj-c objects.
I'd suggest dropping it and also the note about alternative solutions, unless there's a reason we're likely to want to do that instead in the future.

This revision is now accepted and ready to land.Jun 8 2020, 1:29 AM
dgoldman updated this revision to Diff 269189.Jun 8 2020, 5:55 AM

Check AccessOpFixIt.hasValue()

dgoldman updated this revision to Diff 269192.Jun 8 2020, 5:59 AM
dgoldman marked 4 inline comments as done.

Remove stale comment

clang/lib/Sema/SemaCodeComplete.cpp
5153

Ah good call, done

5255

Removed this in favor of a comment in the checks above. Think they're useful (albeit duplicated) since they give some explanation as to why.

sammccall accepted this revision.Jun 8 2020, 8:24 AM

LG, thanks!

clang/lib/Sema/SemaCodeComplete.cpp
5199

I don't really follow what the comment means by "forwarding the fixit". As I understood it, the issue is -> and . are likely both valid, so changing one to the other is confusing. Might be able to reword to clarify.

dgoldman updated this revision to Diff 269269.Jun 8 2020, 9:35 AM
dgoldman marked an inline comment as done.
  • Minor comment fixes
clang/lib/Sema/SemaCodeComplete.cpp
5199

I meant the code previously would try give fix it code completions without marking it as a fix it. But I've gone ahead and removed it in favor of the other comment.

dgoldman updated this revision to Diff 269271.Jun 8 2020, 9:38 AM
  • Fix typo
dgoldman marked an inline comment as done.Jun 8 2020, 9:44 AM
This revision was automatically updated to reflect the committed changes.