[PATCH] D65883: [Extract] Fixed SemicolonExtractionPolicy for Do and Switch Stmt

Shaurya Gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 7 08:20:16 PDT 2019


SureYeaah created this revision.
SureYeaah added reviewers: arphaman, sammccall.
Herald added subscribers: cfe-commits, dexonsmith.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65883

Files:
  clang/lib/Tooling/Refactoring/Extract/SourceExtraction.cpp


Index: clang/lib/Tooling/Refactoring/Extract/SourceExtraction.cpp
===================================================================
--- clang/lib/Tooling/Refactoring/Extract/SourceExtraction.cpp
+++ clang/lib/Tooling/Refactoring/Extract/SourceExtraction.cpp
@@ -36,12 +36,17 @@
     return isSemicolonRequiredAfter(While->getBody());
   if (const auto *For = dyn_cast<ForStmt>(S))
     return isSemicolonRequiredAfter(For->getBody());
+  if (const auto *Do = dyn_cast<DoStmt>(S))
+    return isSemicolonRequiredAfter(Do->getBody());
   if (const auto *CXXFor = dyn_cast<CXXForRangeStmt>(S))
     return isSemicolonRequiredAfter(CXXFor->getBody());
   if (const auto *ObjCFor = dyn_cast<ObjCForCollectionStmt>(S))
     return isSemicolonRequiredAfter(ObjCFor->getBody());
+  if(const auto *Switch = dyn_cast<SwitchStmt>(S))
+    return isSemicolonRequiredAfter(Switch->getBody());
+  if(const auto *Case = dyn_cast<SwitchCase>(S))
+    return isSemicolonRequiredAfter(Case->getSubStmt());
   switch (S->getStmtClass()) {
-  case Stmt::SwitchStmtClass:
   case Stmt::CXXTryStmtClass:
   case Stmt::ObjCAtSynchronizedStmtClass:
   case Stmt::ObjCAutoreleasePoolStmtClass:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65883.213900.patch
Type: text/x-patch
Size: 1171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190807/22ab20d2/attachment.bin>


More information about the cfe-commits mailing list