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 
11 #include "mcld/MC/Attribute.h"
12 #include "mcld/LD/LDContext.h"
13 
14 namespace mcld {
15 
16 //===----------------------------------------------------------------------===//
17 // mcld::Input
18 //===----------------------------------------------------------------------===//
Input(llvm::StringRef pName)19 Input::Input(llvm::StringRef pName)
20     : m_Type(Unknown),
21       m_Name(pName.data()),
22       m_Path(),
23       m_pAttr(NULL),
24       m_bNeeded(false),
25       m_bNoExport(false),
26       m_fileOffset(0),
27       m_pMemArea(NULL),
28       m_pContext(NULL) {
29 }
30 
Input(llvm::StringRef pName,const AttributeProxy & pProxy)31 Input::Input(llvm::StringRef pName, const AttributeProxy& pProxy)
32     : m_Type(Unknown),
33       m_Name(pName.data()),
34       m_Path(),
35       m_pAttr(const_cast<Attribute*>(pProxy.attr())),
36       m_bNeeded(false),
37       m_bNoExport(false),
38       m_fileOffset(0),
39       m_pMemArea(NULL),
40       m_pContext(NULL) {
41 }
42 
Input(llvm::StringRef pName,const sys::fs::Path & pPath,unsigned int pType,off_t pFileOffset)43 Input::Input(llvm::StringRef pName,
44              const sys::fs::Path& pPath,
45              unsigned int pType,
46              off_t pFileOffset)
47     : m_Type(pType),
48       m_Name(pName.data()),
49       m_Path(pPath),
50       m_pAttr(NULL),
51       m_bNeeded(false),
52       m_bNoExport(false),
53       m_fileOffset(pFileOffset),
54       m_pMemArea(NULL),
55       m_pContext(NULL) {
56 }
57 
Input(llvm::StringRef pName,const sys::fs::Path & pPath,const AttributeProxy & pProxy,unsigned int pType,off_t pFileOffset)58 Input::Input(llvm::StringRef pName,
59              const sys::fs::Path& pPath,
60              const AttributeProxy& pProxy,
61              unsigned int pType,
62              off_t pFileOffset)
63     : m_Type(pType),
64       m_Name(pName.data()),
65       m_Path(pPath),
66       m_pAttr(const_cast<Attribute*>(pProxy.attr())),
67       m_bNeeded(false),
68       m_bNoExport(false),
69       m_fileOffset(pFileOffset),
70       m_pMemArea(NULL),
71       m_pContext(NULL) {
72 }
73 
~Input()74 Input::~Input() {
75   // Attribute is deleted by AttributeFactory
76   // MemoryArea is deleted by MemoryAreaFactory
77 }
78 
79 }  // namespace mcld
80