//===--- TransProtectedScope.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 // //===----------------------------------------------------------------------===// // // Adds brackets in case statements that "contain" initialization of retaining // variable, thus emitting the "switch case is in protected scope" error. // //===----------------------------------------------------------------------===// #include "Internals.h" #include "Transforms.h" #include "clang/AST/ASTContext.h" #include "clang/Basic/SourceManager.h" #include "clang/Sema/SemaDiagnostic.h" usingnamespaceclang; usingnamespacearcmt; usingnamespacetrans; namespace { class LocalRefsCollector : public RecursiveASTVisitor<LocalRefsCollector> { … }; struct CaseInfo { … }; class CaseCollector : public RecursiveASTVisitor<CaseCollector> { … }; class ProtectedScopeFixer { … }; } // anonymous namespace void ProtectedScopeTraverser::traverseBody(BodyContext &BodyCtx) { … }