1 //===-- SourceReference.h ---------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_TOOLS_LLDB_VSCODE_SOURCEREFERENCE_H
10 #define LLDB_TOOLS_LLDB_VSCODE_SOURCEREFERENCE_H
12 #include "lldb/lldb-types.h"
13 #include "llvm/ADT/DenseMap.h"
16 namespace lldb_vscode
{
18 struct SourceReference
{
20 llvm::DenseMap
<lldb::addr_t
, int64_t> addr_to_line
;
22 int64_t GetLineForPC(lldb::addr_t pc
) const {
23 auto addr_line
= addr_to_line
.find(pc
);
24 if (addr_line
!= addr_to_line
.end())
25 return addr_line
->second
;
30 } // namespace lldb_vscode