|
| 1 | +//===--- ARCMTActions.cpp - ARC Migrate Tool Frontend Actions ---*- C++ -*-===// |
| 2 | +// |
| 3 | +// The LLVM Compiler Infrastructure |
| 4 | +// |
| 5 | +// This file is distributed under the University of Illinois Open Source |
| 6 | +// License. See LICENSE.TXT for details. |
| 7 | +// |
| 8 | +//===----------------------------------------------------------------------===// |
| 9 | + |
| 10 | +#include "clang/ARCMigrate/ARCMTActions.h" |
| 11 | +#include "clang/ARCMigrate/ARCMT.h" |
| 12 | +#include "clang/Frontend/CompilerInstance.h" |
| 13 | + |
| 14 | +using namespace clang; |
| 15 | +using namespace arcmt; |
| 16 | + |
| 17 | +void CheckAction::ExecuteAction() { |
| 18 | + CompilerInstance &CI = getCompilerInstance(); |
| 19 | + if (arcmt::checkForManualIssues(CI.getInvocation(), getCurrentFile(), |
| 20 | + getCurrentFileKind(), |
| 21 | + CI.getDiagnostics().getClient())) |
| 22 | + return; |
| 23 | + |
| 24 | + // We only want to see warnings reported from arcmt::checkForManualIssues. |
| 25 | + CI.getDiagnostics().setIgnoreAllWarnings(true); |
| 26 | + WrapperFrontendAction::ExecuteAction(); |
| 27 | +} |
| 28 | + |
| 29 | +CheckAction::CheckAction(FrontendAction *WrappedAction) |
| 30 | + : WrapperFrontendAction(WrappedAction) {} |
| 31 | + |
| 32 | +void TransformationAction::ExecuteAction() { |
| 33 | + CompilerInstance &CI = getCompilerInstance(); |
| 34 | + if (arcmt::applyTransformations(CI.getInvocation(), getCurrentFile(), |
| 35 | + getCurrentFileKind(), |
| 36 | + CI.getDiagnostics().getClient())) |
| 37 | + return; |
| 38 | + |
| 39 | + WrapperFrontendAction::ExecuteAction(); |
| 40 | +} |
| 41 | + |
| 42 | +TransformationAction::TransformationAction(FrontendAction *WrappedAction) |
| 43 | + : WrapperFrontendAction(WrappedAction) {} |
| 44 | + |
| 45 | +void InMemoryTransformationAction::ExecuteAction() { |
| 46 | + CompilerInstance &CI = getCompilerInstance(); |
| 47 | + if (arcmt::applyTransformationsInMemory(CI.getInvocation(), getCurrentFile(), |
| 48 | + getCurrentFileKind(), |
| 49 | + CI.getDiagnostics().getClient())) |
| 50 | + return; |
| 51 | + |
| 52 | + WrapperFrontendAction::ExecuteAction(); |
| 53 | +} |
| 54 | + |
| 55 | +InMemoryTransformationAction::InMemoryTransformationAction( |
| 56 | + FrontendAction *WrappedAction) |
| 57 | + : WrapperFrontendAction(WrappedAction) {} |
| 58 | + |
0 commit comments