[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-25 Thread Ivan Donchevskii via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL333272: Optionally add code completion results for arrow instead of dot (authored by yvvan, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D41

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-25 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. This revision is now accepted and ready to land. Thanks for addressing the NITs. LGTM! https://reviews.llvm.org/D41537 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http:

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-25 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 148553. yvvan added a comment. NIT-s addressed https://reviews.llvm.org/D41537 Files: include/clang/Driver/CC1Options.td include/clang/Sema/CodeCompleteConsumer.h include/clang/Sema/CodeCompleteOptions.h include/clang/Sema/Sema.h lib/Frontend/ASTUni

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-25 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan marked an inline comment as done. yvvan added inline comments. Comment at: lib/Sema/SemaCodeComplete.cpp:4148 + + CompletionSucceded |= DoCompletion(Base, IsArrow, None); + yvvan wrote: > ilya-biryukov wrote: > > NIT: maybe swap the two cases to do the non

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-24 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan marked 4 inline comments as done. yvvan added inline comments. Comment at: lib/Sema/SemaCodeComplete.cpp:4148 + + CompletionSucceded |= DoCompletion(Base, IsArrow, None); + ilya-biryukov wrote: > NIT: maybe swap the two cases to do the non-fixit ones first

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. I have only a few nits left, otherwise looks good. Thanks for making this change! Really excited for it to get in finally! Comment at: include/clang/Driver/CC1Options.td:449 +def code_completion_with_fixits : Flag<["-"], "code-completion-with-fix

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-23 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 148164. yvvan marked 4 inline comments as done. https://reviews.llvm.org/D41537 Files: include/clang/Driver/CC1Options.td include/clang/Sema/CodeCompleteConsumer.h include/clang/Sema/CodeCompleteOptions.h include/clang/Sema/Sema.h lib/Frontend/ASTUnit

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-22 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added inline comments. Comment at: lib/Sema/SemaCodeComplete.cpp:4109 + if (CodeCompleter->includeFixIts()) { +const SourceRange OpRange(OpLoc, OpLoc.getLocWithOffset(IsArrow ? 2 : 1)); +CompletionSucceded = ilya-biryukov wrote: > yvvan wrote: > >

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-22 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: lib/Sema/SemaCodeComplete.cpp:4109 + if (CodeCompleter->includeFixIts()) { +const SourceRange OpRange(OpLoc, OpLoc.getLocWithOffset(IsArrow ? 2 : 1)); +CompletionSucceded = yvvan wrote: > ilya-biryukov wro

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-22 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added inline comments. Comment at: lib/Sema/CodeCompleteConsumer.cpp:559 +const char *Begin = +SemaRef.SourceMgr.getCharacterData(FixIt.RemoveRange.getBegin()); +const char *End = ilya-biryukov wrote: > Unfortunately, that might

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-17 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Sorry, a few more things and we're good to go. Comment at: include/clang/Driver/CC1Options.td:449 +def code_completion_include_fixits : Flag<["-"], "code-completion-include-fixits">, + HelpText<"Include code completion results which require havi

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-16 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 147039. yvvan marked 4 inline comments as done. yvvan added a comment. Append PrintingCodeCompleteConsumer and CompilerInvocation options, add CodeCompletion tests. https://reviews.llvm.org/D41537 Files: include/clang/Driver/CC1Options.td include/clang/S

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-15 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added a comment. I will add more tests... Comment at: test/SemaCXX/member-expr.cpp:193 +Cl0* c; +return c.a; // expected-error {{member reference type 'PR15045::Cl0 *' is a pointer; did you mean to use '->'?}} + } ilya-biryukov wrote: > Is this

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-15 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Maybe move the tests back to this revision? There are tests for code completion that don't depend on libindex or libclang and use clang -cc1 directly, i.e. `tools/clang/test/CodeComplete`. This would require adding a flag to clang and patching up `PrintingCodeCompl

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-14 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added inline comments. Comment at: lib/Sema/SemaCodeComplete.cpp:4118 + : diag::err_typecheck_member_reference_suggestion; + Diag(OpLoc, DiagID) << ConvertedBaseType << IsArrow + << Base->getSourceRange() << FixIt;

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-14 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 146749. yvvan marked 2 inline comments as done. yvvan added a comment. Only C++ part, libclang part has moved to https://reviews.llvm.org/D46862 https://reviews.llvm.org/D41537 Files: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/CodeCompl

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-14 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: tools/libclang/CIndexCodeCompletion.cpp:309 + /// before that result for the corresponding completion item. + std::vector> FixItsVector; }; yvvan wrote: > ilya-biryukov wrote: > > Storing `vector>` here makes lo

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-14 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added a comment. In https://reviews.llvm.org/D41537#1097763, @ilya-biryukov wrote: > I should've suggested splitting the change into two earlier. Next time I will do that from the beginning :) Comment at: tools/libclang/CIndexCodeCompletion.cpp:309 + /// before that r

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-14 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. In https://reviews.llvm.org/D41537#1097601, @yvvan wrote: > I hope this review will be over some day :) Sorry for keeping it that long. FWIW, I think we keep jumping back and forth between the clang and libclang changes here. I should've suggested splitting the c

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-14 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added a comment. ping I hope this review won't take forever :) https://reviews.llvm.org/D41537 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-11 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 146289. yvvan marked 3 inline comments as done. yvvan added a comment. Only keep small completion fixit-s in CodeCompletionResults. Change libclang calls to overcome that and not use CXCompletionString https://reviews.llvm.org/D41537 Files: include/clang-c/

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-09 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan marked 3 inline comments as done. yvvan added a comment. I have some failing tests... So I will update the diff a bit later (Friday most likely) Comment at: include/clang/Sema/CodeCompleteConsumer.h:564 + + /// \brief For this completion result correction is required. +

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: include/clang-c/Index.h:5237 +/** + * \brief FixIts that *must* be applied before inserting the text for the + * corresponding completion item. Completion items with non-empty fixits will This seems too large for a

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-08 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 145664. yvvan added a comment. Address comments and provide diff with full context https://reviews.llvm.org/D41537 Files: include/clang-c/Index.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/CodeCompleteConsumer.h include/clang/Sema/C

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-08 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added inline comments. Comment at: include/clang-c/Index.h:5220 +CINDEX_LINKAGE CXString +clang_getCompletionCorrection(CXCompletionString completion_string, + unsigned correction_index, ilya-biryukov wrote: > I'm a bit vary abo

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-04 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Sorry for the delay. I really like the direction of this patch! What's left is defining the semantics of corrections more thoroughly to make sure we don't have tricky corner cases that users of the API can't deal with. PS. This patch is still lacking full context o

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-05-03 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added a comment. Ping https://reviews.llvm.org/D41537 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-04-26 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added inline comments. Comment at: include/clang/Sema/CodeCompleteConsumer.h:704 +CXAvailabilityKind Availability, +const std::vector &Corrections) : Allocator(Allocator), CCTUInfo(CCTUInfo), Priority(Priority), ---

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-04-26 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 144285. yvvan marked 4 inline comments as done. yvvan added a comment. Minor clean-up according to the last comments https://reviews.llvm.org/D41537 Files: include/clang-c/Index.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/CodeComplet

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-04-26 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Could you upload the patch with full context? Comment at: include/clang/Sema/CodeCompleteConsumer.h:704 +CXAvailabilityKind Availability, +const std::vector &Corrections) : Allocator(Allocator

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-04-26 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 144076. yvvan added a comment. Wrapper around FIxItHint is removed, other review comments are addressed . https://reviews.llvm.org/D41537 Files: include/clang-c/Index.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/CodeCompleteConsumer.h

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-04-25 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added inline comments. Comment at: include/clang-c/Index.h:5278 + /** + * \brief Whether to try dot to arrow correction if arrow operator can be applied. + */ ilya-biryukov wrote: > This implies that "dot to arrow" is the only available correction. Ma

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-04-25 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Important: please upload the patch with full context diff Comment at: include/clang-c/Index.h:5278 + /** + * \brief Whether to try dot to arrow correction if arrow operator can be applied. + */ This implies that "dot to arro

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-04-23 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 143572. yvvan added a comment. Use vector instead of optional as Ilya suggested https://reviews.llvm.org/D41537 Files: include/clang-c/Index.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/CodeCompleteConsumer.h include/clang/Sema/Code

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-04-23 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 143566. yvvan added a comment. Use wrapped FixItHint to keep corrections. Can be quite easily changed from Optional to some container if required. https://reviews.llvm.org/D41537 Files: include/clang-c/Index.h include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-04-03 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Sorry for the late response, was on vacation. Comment at: include/clang/Sema/CodeCompleteConsumer.h:565 + /// \brief For this completion result correction is required. + Optional Corr = None; + yvvan wrote: > yvvan wrote: > > il

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-03-28 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added inline comments. Comment at: include/clang/Sema/CodeCompleteConsumer.h:565 + /// \brief For this completion result correction is required. + Optional Corr = None; + yvvan wrote: > ilya-biryukov wrote: > > Having a string replacement without an actua

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-03-21 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added inline comments. Comment at: include/clang/Sema/CodeCompleteConsumer.h:565 + /// \brief For this completion result correction is required. + Optional Corr = None; + ilya-biryukov wrote: > Having a string replacement without an actual range to replac

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-03-19 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Sorry for the delay. Comment at: include/clang/Sema/CodeCompleteConsumer.h:565 + /// \brief For this completion result correction is required. + Optional Corr = None; + Having a string replacement without an actual range to repl

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-03-19 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added a comment. Ping https://reviews.llvm.org/D41537 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-03-13 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 138139. yvvan added a comment. Return possibly required corrections in the string form https://reviews.llvm.org/D41537 Files: include/clang-c/Index.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/CodeCompleteConsumer.h include/clang/Se

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-02-22 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. In https://reviews.llvm.org/D41537#1015563, @yvvan wrote: > Or is your idea is to return the char sequence instead to use this correction > in some universal way? Exactly. Editors that implement corrections would pick up any new corrections automatically, rather

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-02-22 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added a comment. Or is your idea is to return the char sequence instead to use this correction in some universal way? https://reviews.llvm.org/D41537 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailma

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-02-21 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added a comment. I've already added hints in this patch and it also do not add extra completions unless the flag IncludeCorrections is set. So this will not force editors to use corrections. Did you mean that you think it's good to have extra fixit hints even if this flag is not set? h

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-02-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Sorry for not getting back on this earlier. I wanted to discuss whether returning correction as a enum value is a proper interface for users of `libclang`. It seems easy to replace `.` with `->` inside clang, properly handling all the tricky cases (tokens coming f

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-02-20 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added a comment. ping https://reviews.llvm.org/D41537 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-02-07 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added a comment. ping... https://reviews.llvm.org/D41537 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-01-31 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 132146. yvvan added a comment. Use https://reviews.llvm.org/D42474 code. Add missing parts and tests for errors and fixits. https://reviews.llvm.org/D41537 Files: include/clang-c/Index.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/Cod

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-01-29 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan marked 4 inline comments as done. yvvan added a comment. @ilya-biryukov Thanks a lot for you comments and for the provided code replacement. I'm checking now how it works and will continue addressing other comments. https://reviews.llvm.org/D41537 __

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-01-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. I also propose to try correcting in both directions, i.e. here's how completion completion could work with this feature: struct X { int foobarbaz; }; void test() { X var; X* ptr; std::unique_ptr uptr; var->foobar // replace with var.foo

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-01-24 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Sorry for not taking a look for a long time. I think that would be a very useful feature to have. Here are a few comments (also see the inline comments) - Please add tests - How would the clients know how to correct dot to arrow? It'd be cool if code completion re

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-01-24 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added a comment. Ping!!! https://reviews.llvm.org/D41537 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-01-22 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added a comment. One more Ping! https://reviews.llvm.org/D41537 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-01-18 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 130384. yvvan added a comment. Rebased. Applies for current master. Also ping again... https://reviews.llvm.org/D41537 Files: include/clang-c/Index.h include/clang/Sema/CodeCompleteConsumer.h include/clang/Sema/CodeCompleteOptions.h lib/Frontend/ASTU

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-01-10 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan added a comment. ping https://reviews.llvm.org/D41537 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2018-01-03 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan updated this revision to Diff 128509. yvvan added a comment. Update CIndex minor version, add call to libclang.exports https://reviews.llvm.org/D41537 Files: include/clang-c/Index.h include/clang/Sema/CodeCompleteConsumer.h include/clang/Sema/CodeCompleteOptions.h lib/Frontend/AST

[PATCH] D41537: Optionally add code completion results for arrow instead of dot

2017-12-22 Thread Ivan Donchevskii via Phabricator via cfe-commits
yvvan created this revision. yvvan added reviewers: klimek, bkramer, arphaman, ilya-biryukov, erikjv. Currently getting such completions requires source correction, reparsing and calling completion again. And if it shows no results and rollback is required then it costs one more reparse. With th