Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/lib/ARCMigrate/ARCMTActions.cpp
Line
Count
Source (jump to first uncovered line)
1
//===--- ARCMTActions.cpp - ARC Migrate Tool Frontend Actions ---*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "clang/ARCMigrate/ARCMTActions.h"
10
#include "clang/ARCMigrate/ARCMT.h"
11
#include "clang/Frontend/CompilerInstance.h"
12
13
using namespace clang;
14
using namespace arcmt;
15
16
15
bool CheckAction::BeginInvocation(CompilerInstance &CI) {
17
15
  if (arcmt::checkForManualIssues(CI.getInvocation(), getCurrentInput(),
18
15
                                  CI.getPCHContainerOperations(),
19
15
                                  CI.getDiagnostics().getClient()))
20
11
    return false; // errors, stop the action.
21
4
22
4
  // We only want to see warnings reported from arcmt::checkForManualIssues.
23
4
  CI.getDiagnostics().setIgnoreAllWarnings(true);
24
4
  return true;
25
4
}
26
27
CheckAction::CheckAction(std::unique_ptr<FrontendAction> WrappedAction)
28
15
  : WrapperFrontendAction(std::move(WrappedAction)) {}
29
30
2
bool ModifyAction::BeginInvocation(CompilerInstance &CI) {
31
2
  return !arcmt::applyTransformations(CI.getInvocation(), getCurrentInput(),
32
2
                                      CI.getPCHContainerOperations(),
33
2
                                      CI.getDiagnostics().getClient());
34
2
}
35
36
ModifyAction::ModifyAction(std::unique_ptr<FrontendAction> WrappedAction)
37
2
  : WrapperFrontendAction(std::move(WrappedAction)) {}
38
39
8
bool MigrateAction::BeginInvocation(CompilerInstance &CI) {
40
8
  if (arcmt::migrateWithTemporaryFiles(
41
8
          CI.getInvocation(), getCurrentInput(), CI.getPCHContainerOperations(),
42
8
          CI.getDiagnostics().getClient(), MigrateDir, EmitPremigrationARCErros,
43
8
          PlistOut))
44
0
    return false; // errors, stop the action.
45
8
46
8
  // We only want to see diagnostics emitted by migrateWithTemporaryFiles.
47
8
  CI.getDiagnostics().setIgnoreAllWarnings(true);
48
8
  return true;
49
8
}
50
51
MigrateAction::MigrateAction(std::unique_ptr<FrontendAction> WrappedAction,
52
                             StringRef migrateDir,
53
                             StringRef plistOut,
54
                             bool emitPremigrationARCErrors)
55
  : WrapperFrontendAction(std::move(WrappedAction)), MigrateDir(migrateDir),
56
8
    PlistOut(plistOut), EmitPremigrationARCErros(emitPremigrationARCErrors) {
57
8
  if (MigrateDir.empty())
58
0
    MigrateDir = "."; // user current directory if none is given.
59
8
}