lldb-sys 0.0.13

Raw bindings to the LLDB C++ API. LLDB is the debugger that is part of the LLVM project and is the default system debugger on Mac OS X. Building and using this is currently slightly tricky, so be sure to see the README.md in the repository.
//===-- SBCompileUnitBinding.cpp --------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "lldb/Bindings/LLDBBinding.h"
#include "lldb/API/LLDB.h"

using namespace lldb;

#ifdef __cplusplus
extern "C" {
#endif

SBCompileUnitRef
CreateSBCompileUnit()
{
    return reinterpret_cast<SBCompileUnitRef>(new SBCompileUnit());
}

void
DisposeSBCompileUnit(SBCompileUnitRef instance)
{
    delete reinterpret_cast<SBCompileUnit *>(instance);
}

bool
SBCompileUnitIsValid(SBCompileUnitRef instance)
{
    SBCompileUnit *unwrapped = reinterpret_cast<SBCompileUnit *>(instance);
    return unwrapped->IsValid();
}

SBFileSpecRef
SBCompileUnitGetFileSpec(SBCompileUnitRef instance)
{
    SBCompileUnit *unwrapped = reinterpret_cast<SBCompileUnit *>(instance);
    return reinterpret_cast<SBFileSpecRef>(new SBFileSpec(unwrapped->GetFileSpec()));
}

unsigned int
SBCompileUnitGetNumLineEntries(SBCompileUnitRef instance)
{
    SBCompileUnit *unwrapped = reinterpret_cast<SBCompileUnit *>(instance);
    return unwrapped->GetNumLineEntries();
}

SBLineEntryRef
SBCompileUnitGetLineEntryAtIndex(SBCompileUnitRef instance, uint32_t idx)
{
    SBCompileUnit *unwrapped = reinterpret_cast<SBCompileUnit *>(instance);
    return reinterpret_cast<SBLineEntryRef>(new SBLineEntry(unwrapped->GetLineEntryAtIndex(idx)));
}

unsigned int
SBCompileUnitFindLineEntryIndex(SBCompileUnitRef instance, uint32_t start_idx, uint32_t line,
                                    SBFileSpecRef inline_file_spec)
{
    SBCompileUnit *unwrapped = reinterpret_cast<SBCompileUnit *>(instance);
    return unwrapped->FindLineEntryIndex(start_idx, line, reinterpret_cast<SBFileSpec *>(inline_file_spec));
}

unsigned int
SBCompileUnitFindLineEntryIndex2(SBCompileUnitRef instance, uint32_t start_idx, uint32_t line,
                                     SBFileSpecRef inline_file_spec, bool exact)
{
    SBCompileUnit *unwrapped = reinterpret_cast<SBCompileUnit *>(instance);
    return unwrapped->FindLineEntryIndex(start_idx, line, reinterpret_cast<SBFileSpec *>(inline_file_spec), exact);
}

SBFileSpecRef
SBCompileUnitGetSupportFileAtIndex(SBCompileUnitRef instance, uint32_t idx)
{
    SBCompileUnit *unwrapped = reinterpret_cast<SBCompileUnit *>(instance);
    return reinterpret_cast<SBFileSpecRef>(new SBFileSpec(unwrapped->GetSupportFileAtIndex(idx)));
}

unsigned int
SBCompileUnitGetNumSupportFiles(SBCompileUnitRef instance)
{
    SBCompileUnit *unwrapped = reinterpret_cast<SBCompileUnit *>(instance);
    return unwrapped->GetNumSupportFiles();
}

unsigned int
SBCompileUnitFindSupportFileIndex(SBCompileUnitRef instance, uint32_t start_idx, SBFileSpecRef sb_file,
                                      bool full)
{
    SBCompileUnit *unwrapped = reinterpret_cast<SBCompileUnit *>(instance);
    return unwrapped->FindSupportFileIndex(start_idx, *reinterpret_cast<SBFileSpec *>(sb_file), full);
}

SBTypeListRef
SBCompileUnitGetTypes(SBCompileUnitRef instance, uint32_t type_mask)
{
    SBCompileUnit *unwrapped = reinterpret_cast<SBCompileUnit *>(instance);
    return reinterpret_cast<SBTypeListRef>(new SBTypeList(unwrapped->GetTypes(type_mask)));
}

enum lldb::LanguageType
SBCompileUnitGetLanguage(SBCompileUnitRef instance)
{
    SBCompileUnit *unwrapped = reinterpret_cast<SBCompileUnit *>(instance);
    return unwrapped->GetLanguage();
}

bool
SBCompileUnitGetDescription(SBCompileUnitRef instance, SBStreamRef description)
{
    SBCompileUnit *unwrapped = reinterpret_cast<SBCompileUnit *>(instance);
    return unwrapped->GetDescription(*reinterpret_cast<SBStream *>(description));
}

#ifdef __cplusplus
}
#endif