Coverage Report

Created: 2017-11-21 16:49

/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
//                     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
// Helper function for extracting region debug information.
11
//
12
//===----------------------------------------------------------------------===//
13
//
14
#include "polly/Support/ScopLocation.h"
15
#include "llvm/Analysis/RegionInfo.h"
16
#include "llvm/IR/BasicBlock.h"
17
#include "llvm/IR/DebugInfo.h"
18
#include "llvm/IR/DebugLoc.h"
19
20
using namespace llvm;
21
22
namespace polly {
23
24
void getDebugLocation(const Region *R, unsigned &LineBegin, unsigned &LineEnd,
25
4
                      std::string &FileName) {
26
4
  LineBegin = -1;
27
4
  LineEnd = 0;
28
4
29
4
  for (const BasicBlock *BB : R->blocks())
30
65
    
for (const Instruction &Inst : *BB) 25
{
31
65
      DebugLoc DL = Inst.getDebugLoc();
32
65
      if (!DL)
33
65
        continue;
34
0
35
0
      auto *Scope = cast<DIScope>(DL.getScope());
36
0
37
0
      if (FileName.empty())
38
0
        FileName = Scope->getFilename();
39
25
40
25
      unsigned NewLine = DL.getLine();
41
25
42
25
      LineBegin = std::min(LineBegin, NewLine);
43
25
      LineEnd = std::max(LineEnd, NewLine);
44
25
    }
45
4
}
46
} // namespace polly