Coverage Report

Created: 2019-02-20 07:29

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/polly/lib/Support/ScopLocation.cpp
Line
Count
Source
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/BasicBlock.h"
16
#include "llvm/IR/DebugInfo.h"
17
#include "llvm/IR/DebugLoc.h"
18
19
using namespace llvm;
20
21
namespace polly {
22
23
void getDebugLocation(const Region *R, unsigned &LineBegin, unsigned &LineEnd,
24
6
                      std::string &FileName) {
25
6
  LineBegin = -1;
26
6
  LineEnd = 0;
27
6
28
6
  for (const BasicBlock *BB : R->blocks())
29
81
    
for (const Instruction &Inst : *BB)27
{
30
81
      DebugLoc DL = Inst.getDebugLoc();
31
81
      if (!DL)
32
67
        continue;
33
14
34
14
      auto *Scope = cast<DIScope>(DL.getScope());
35
14
36
14
      if (FileName.empty())
37
2
        FileName = Scope->getFilename();
38
14
39
14
      unsigned NewLine = DL.getLine();
40
14
41
14
      LineBegin = std::min(LineBegin, NewLine);
42
14
      LineEnd = std::max(LineEnd, NewLine);
43
14
    }
44
6
}
45
} // namespace polly