Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 1 | //===-- SBSourceManager.cpp -------------------------------------*- 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 | |
Eli Friedman | 7a62c8b | 2010-06-09 07:44:37 +0000 | [diff] [blame^] | 11 | #include "lldb/API/SBSourceManager.h" |
Chris Lattner | 24943d2 | 2010-06-08 16:52:24 +0000 | [diff] [blame] | 12 | |
| 13 | #include "lldb/API/SBFileSpec.h" |
| 14 | #include "lldb/Core/Stream.h" |
| 15 | #include "lldb/Core/StreamFile.h" |
| 16 | #include "lldb/Core/SourceManager.h" |
| 17 | |
| 18 | |
| 19 | using namespace lldb; |
| 20 | using namespace lldb_private; |
| 21 | |
| 22 | |
| 23 | SBSourceManager::SBSourceManager (SourceManager& source_manager) : |
| 24 | m_source_manager (source_manager) |
| 25 | { |
| 26 | } |
| 27 | |
| 28 | SBSourceManager::~SBSourceManager() |
| 29 | { |
| 30 | } |
| 31 | |
| 32 | size_t |
| 33 | SBSourceManager::DisplaySourceLinesWithLineNumbers |
| 34 | ( |
| 35 | const SBFileSpec &file, |
| 36 | uint32_t line, |
| 37 | uint32_t context_before, |
| 38 | uint32_t context_after, |
| 39 | const char* current_line_cstr, |
| 40 | FILE *f |
| 41 | ) |
| 42 | { |
| 43 | if (f == NULL) |
| 44 | return 0; |
| 45 | |
| 46 | if (file.IsValid()) |
| 47 | { |
| 48 | StreamFile str (f); |
| 49 | |
| 50 | |
| 51 | return m_source_manager.DisplaySourceLinesWithLineNumbers (*file, |
| 52 | line, |
| 53 | context_before, |
| 54 | context_after, |
| 55 | current_line_cstr, |
| 56 | &str); |
| 57 | } |
| 58 | return 0; |
| 59 | } |
| 60 | |
| 61 | SourceManager & |
| 62 | SBSourceManager::GetLLDBManager () |
| 63 | { |
| 64 | return m_source_manager; |
| 65 | } |