-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDebugInfo.cpp
More file actions
42 lines (31 loc) · 1.08 KB
/
Copy pathDebugInfo.cpp
File metadata and controls
42 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Copyright (C) 2014 - 2020 Map2Check tool
* This file is part of the Map2Check tool, and is made available under
* the terms of the GNU General Public License version 2.
*
* LLVM -> NCSA
*
* SPDX-License-Identifier: (GPL-2.0 AND NCSA)
**/
#include "DebugInfo.hpp"
DebugInfo::DebugInfo(LLVMContext* ctx, Instruction* i) {
DebugLoc location = i->getDebugLoc();
unsigned scope_number;
unsigned line_number;
if (location) {
scope_number = location.getScope()->getMetadataID();
line_number = location.getLine();
} else {
scope_number = 0;
line_number = 0;
}
this->scopeNumberValue =
ConstantInt ::getSigned(Type::getInt32Ty(*ctx), scope_number);
this->lineNumberValue =
ConstantInt ::getSigned(Type::getInt32Ty(*ctx), line_number);
this->lineNumInt = line_number;
}
Value* DebugInfo::getScopeNumberValue() { return this->scopeNumberValue; }
Value* DebugInfo::getLineNumberValue() { return this->lineNumberValue; }
unsigned DebugInfo::getLineNumberInt() { return this->lineNumInt; }
StringRef DebugInfo::getVarName() { return this->varName; }