Input.cpp revision 87f34658dec9097d987d254a990ea7f311bfc95f
1//===- Input.cpp ----------------------------------------------------------===//
2//
3//                     The MCLinker Project
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9#include <mcld/MC/Input.h>
10#include <mcld/MC/Attribute.h>
11#include <mcld/LD/LDContext.h>
12
13using namespace mcld;
14
15//===----------------------------------------------------------------------===//
16// mcld::Input
17//===----------------------------------------------------------------------===//
18Input::Input(llvm::StringRef pName)
19  : m_Type(Unknown),
20    m_Name(pName.data()),
21    m_Path(),
22    m_pAttr(NULL),
23    m_bNeeded(false),
24    m_fileOffset(0),
25    m_pMemArea(NULL),
26    m_pContext(NULL) {
27}
28
29Input::Input(llvm::StringRef pName, const AttributeProxy& pProxy)
30  : m_Type(Unknown),
31    m_Name(pName.data()),
32    m_Path(),
33    m_pAttr(const_cast<Attribute*>(pProxy.attr())),
34    m_bNeeded(false),
35    m_fileOffset(0),
36    m_pMemArea(NULL),
37    m_pContext(NULL) {
38}
39
40Input::Input(llvm::StringRef pName,
41        const sys::fs::Path& pPath,
42        unsigned int pType,
43        off_t pFileOffset)
44  : m_Type(pType),
45    m_Name(pName.data()),
46    m_Path(pPath),
47    m_pAttr(NULL),
48    m_bNeeded(false),
49    m_fileOffset(pFileOffset),
50    m_pMemArea(NULL),
51    m_pContext(NULL) {
52}
53
54Input::Input(llvm::StringRef pName,
55        const sys::fs::Path& pPath,
56        const AttributeProxy& pProxy,
57        unsigned int pType,
58        off_t pFileOffset)
59  : m_Type(pType),
60    m_Name(pName.data()),
61    m_Path(pPath),
62    m_pAttr(const_cast<Attribute*>(pProxy.attr())),
63    m_bNeeded(false),
64    m_fileOffset(pFileOffset),
65    m_pMemArea(NULL),
66    m_pContext(NULL) {
67}
68
69Input::~Input()
70{
71  // Attribute is deleted by AttributeFactory
72  // MemoryArea is deleted by MemoryAreaFactory
73}
74
75