Coverage Report

Created: 2019-04-21 11:35

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/Support/ScopLocation.cpp
Line
Count
Source (jump to first uncovered line)
1
//=== ScopLocation.cpp - Debug location for ScopDetection ----- -*- 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
// Helper function for extracting region debug information.
10
//
11
//===----------------------------------------------------------------------===//
12
//
13
#include "polly/Support/ScopLocation.h"
14
#include "llvm/Analysis/RegionInfo.h"
15
#include "llvm/IR/DebugInfoMetadata.h"
16
17
using namespace llvm;
18
19
namespace polly {
20
21
void getDebugLocation(const Region *R, unsigned &LineBegin, unsigned &LineEnd,
22
0
                      std::string &FileName) {
23
0
  LineBegin = -1;
24
0
  LineEnd = 0;
25
0
26
0
  for (const BasicBlock *BB : R->blocks())
27
0
    for (const Instruction &Inst : *BB) {
28
0
      DebugLoc DL = Inst.getDebugLoc();
29
0
      if (!DL)
30
0
        continue;
31
0
32
0
      auto *Scope = cast<DIScope>(DL.getScope());
33
0
34
0
      if (FileName.empty())
35
0
        FileName = Scope->getFilename();
36
0
37
0
      unsigned NewLine = DL.getLine();
38
0
39
0
      LineBegin = std::min(LineBegin, NewLine);
40
0
      LineEnd = std::max(LineEnd, NewLine);
41
0
    }
42
0
}
43
} // namespace polly