This is an archive of the discontinued LLVM Phabricator instance.

[Clangd] ExtractFunction: Don't extract body of enclosing function.
ClosedPublic

Authored by SureYeaah on Sep 30 2019, 3:05 PM.

Details

Summary

This patch disable extraction of the body of the enclosing function.
void f() [[{}]]

Extracting this CompoundStmt would leave the enclosing function without
a body.

Event Timeline

SureYeaah created this revision.Sep 30 2019, 3:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 30 2019, 3:05 PM
kadircet accepted this revision.Oct 1 2019, 2:35 AM

LGTM, thanks

clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
234

I believe it is not possible to have an EnclosingFunc without a body at this point. Let's make it an assertion instead.

This revision is now accepted and ready to land.Oct 1 2019, 2:35 AM
SureYeaah updated this revision to Diff 222815.Oct 2 2019, 6:12 AM
SureYeaah marked an inline comment as done.

Added assert and removed fixme

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 2 2019, 6:51 AM