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