This is an archive of the discontinued LLVM Phabricator instance.

[CodeComplete] Propagate preferred type for function arguments in more cases
ClosedPublic

Authored by ilya-biryukov on Feb 22 2019, 2:58 AM.

Details

Summary

See the added test for some new cases.
This change also removes special code completion calls inside the
ParseExpressionList function now that we properly propagate expected
type to the function responsible for parsing elements of the expression list
(ParseAssignmentExpression).

Diff Detail

Repository
rL LLVM

Event Timeline

ilya-biryukov created this revision.Feb 22 2019, 2:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2019, 2:58 AM
Herald added a subscriber: jdoerfert. · View Herald Transcript
kadircet added inline comments.Feb 25 2019, 2:55 AM
clang/include/clang/Sema/Sema.h
294 ↗(On Diff #187915)

Is it only to avoid copy costs?

clang/lib/Parse/ParseDeclCXX.cpp
3490 ↗(On Diff #187915)

IIUC, deleting this call is safe, since it is going to be called in ParseAssignmentExpression. Could you add a comment stating that?(same for other deleted call sites of this function.)

clang/unittests/Sema/CodeCompleteTest.cpp
457 ↗(On Diff #187915)

Can you also try in the middle of an identifier, like vec^tor()

458 ↗(On Diff #187915)

maybe add a test for second parameter as well?

xbolva00 added inline comments.
clang/lib/Sema/SemaCodeComplete.cpp
494 ↗(On Diff #187915)

Typo?

Charusso removed a subscriber: Charusso.Feb 25 2019, 3:09 AM
ilya-biryukov edited the summary of this revision. (Show Details)Feb 25 2019, 11:00 AM
ilya-biryukov marked 3 inline comments as done.
  • Check in the middle and at the end of identifiers.
  • Add a test for the second parameter and a class member function
clang/include/clang/Sema/Sema.h
294 ↗(On Diff #187915)

Using std::function won't help much, all functions we pass here actually capture local variables by reference.

clang/lib/Parse/ParseDeclCXX.cpp
3490 ↗(On Diff #187915)

Exactly! I changed the description of the change instead of adding a comment.
In the new version ParseExpressionList is not responsible for the code completion anymore and leaving the comment merely for historical reasons does not look appealing.

ilya-biryukov marked 2 inline comments as done.
  • Fix a typo
clang/lib/Sema/SemaCodeComplete.cpp
494 ↗(On Diff #187915)

Fixed it. Thanks.

kadircet accepted this revision.Feb 25 2019, 2:03 PM

Thanks!

This revision is now accepted and ready to land.Feb 25 2019, 2:03 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2019, 3:02 AM