[PATCH] D39441: [refactor][extract] insert semicolons into extracted/inserted code when needed

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 30 18:36:51 PDT 2017


arphaman created this revision.
Herald added a subscriber: mgorny.

This patch implements the semicolon insertion logic into the extract refactoring.
The following rules are taken:

- extracting expression: add terminating ';' to the extracted function.
- extracting statements that don't require terminating ';' (e.g. switch): add terminating ';' to the callee.
- extracting statements with ';':  move (if possible) the original ';' from the callee and add terminating ';'.
- otherwise, add ';' to both places.


Repository:
  rL LLVM

https://reviews.llvm.org/D39441

Files:
  include/clang/Lex/Lexer.h
  lib/Lex/Lexer.cpp
  lib/Tooling/Refactoring/CMakeLists.txt
  lib/Tooling/Refactoring/Extract.cpp
  lib/Tooling/Refactoring/SourceExtraction.cpp
  lib/Tooling/Refactoring/SourceExtraction.h
  test/Refactor/Extract/ExtractExprIntoFunction.cpp
  test/Refactor/Extract/ExtractionSemicolonPolicy.cpp
  test/Refactor/Extract/ExtractionSemicolonPolicy.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39441.120921.patch
Type: text/x-patch
Size: 20271 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171031/8a6fd034/attachment-0001.bin>


More information about the cfe-commits mailing list