//===-- TransEmptyStatementsAndDealloc.cpp - Transformations to ARC mode --===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // removeEmptyStatementsAndDealloc: // // Removes empty statements that are leftovers from previous transformations. // e.g for // // [x retain]; // // removeRetainReleaseDealloc will leave an empty ";" that removeEmptyStatements // will remove. // //===----------------------------------------------------------------------===// #include "Transforms.h" #include "Internals.h" #include "clang/AST/ASTContext.h" #include "clang/AST/StmtVisitor.h" #include "clang/Basic/SourceManager.h" usingnamespaceclang; usingnamespacearcmt; usingnamespacetrans; static bool isEmptyARCMTMacroStatement(NullStmt *S, std::vector<SourceLocation> &MacroLocs, ASTContext &Ctx) { … } namespace { /// Returns true if the statement became empty due to previous /// transformations. class EmptyChecker : public StmtVisitor<EmptyChecker, bool> { … }; class EmptyStatementsRemover : public RecursiveASTVisitor<EmptyStatementsRemover> { … }; } // anonymous namespace static bool isBodyEmpty(CompoundStmt *body, ASTContext &Ctx, std::vector<SourceLocation> &MacroLocs) { … } static void cleanupDeallocOrFinalize(MigrationPass &pass) { … } void trans::removeEmptyStatementsAndDeallocFinalize(MigrationPass &pass) { … }