Make ObjectFile ownership of the MemoryBuffer optional.
[oota-llvm.git] / include / llvm / Object / ObjectFile.h
1 //===- ObjectFile.h - File format independent object file -------*- 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 // This file declares a file format independent ObjectFile class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_OBJECT_OBJECTFILE_H
15 #define LLVM_OBJECT_OBJECTFILE_H
16
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Object/Binary.h"
19 #include "llvm/Support/DataTypes.h"
20 #include "llvm/Support/ErrorHandling.h"
21 #include "llvm/Support/FileSystem.h"
22 #include "llvm/Support/MemoryBuffer.h"
23 #include <cstring>
24 #include <vector>
25
26 namespace llvm {
27 namespace object {
28
29 class ObjectFile;
30
31 union DataRefImpl {
32   // This entire union should probably be a
33   // char[max(8, sizeof(uintptr_t))] and require the impl to cast.
34   struct {
35     uint32_t a, b;
36   } d;
37   uintptr_t p;
38   DataRefImpl() {
39     std::memset(this, 0, sizeof(DataRefImpl));
40   }
41 };
42
43 template<class content_type>
44 class content_iterator {
45   content_type Current;
46 public:
47   content_iterator(content_type symb)
48     : Current(symb) {}
49
50   const content_type* operator->() const {
51     return &Current;
52   }
53
54   const content_type &operator*() const {
55     return Current;
56   }
57
58   bool operator==(const content_iterator &other) const {
59     return Current == other.Current;
60   }
61
62   bool operator!=(const content_iterator &other) const {
63     return !(*this == other);
64   }
65
66   content_iterator& increment(error_code &err) {
67     content_type next;
68     if (error_code ec = Current.getNext(next))
69       err = ec;
70     else
71       Current = next;
72     return *this;
73   }
74 };
75
76 inline bool operator==(const DataRefImpl &a, const DataRefImpl &b) {
77   // Check bitwise identical. This is the only legal way to compare a union w/o
78   // knowing which member is in use.
79   return std::memcmp(&a, &b, sizeof(DataRefImpl)) == 0;
80 }
81
82 inline bool operator<(const DataRefImpl &a, const DataRefImpl &b) {
83   // Check bitwise identical. This is the only legal way to compare a union w/o
84   // knowing which member is in use.
85   return std::memcmp(&a, &b, sizeof(DataRefImpl)) < 0;
86 }
87
88 class SymbolRef;
89 typedef content_iterator<SymbolRef> symbol_iterator;
90
91 /// RelocationRef - This is a value type class that represents a single
92 /// relocation in the list of relocations in the object file.
93 class RelocationRef {
94   DataRefImpl RelocationPimpl;
95   const ObjectFile *OwningObject;
96
97 public:
98   RelocationRef() : OwningObject(NULL) { }
99
100   RelocationRef(DataRefImpl RelocationP, const ObjectFile *Owner);
101
102   bool operator==(const RelocationRef &Other) const;
103
104   error_code getNext(RelocationRef &Result) const;
105
106   error_code getAddress(uint64_t &Result) const;
107   error_code getOffset(uint64_t &Result) const;
108   symbol_iterator getSymbol() const;
109   error_code getType(uint64_t &Result) const;
110
111   /// @brief Indicates whether this relocation should hidden when listing
112   /// relocations, usually because it is the trailing part of a multipart
113   /// relocation that will be printed as part of the leading relocation.
114   error_code getHidden(bool &Result) const;
115
116   /// @brief Get a string that represents the type of this relocation.
117   ///
118   /// This is for display purposes only.
119   error_code getTypeName(SmallVectorImpl<char> &Result) const;
120
121   /// @brief Get a string that represents the calculation of the value of this
122   ///        relocation.
123   ///
124   /// This is for display purposes only.
125   error_code getValueString(SmallVectorImpl<char> &Result) const;
126
127   DataRefImpl getRawDataRefImpl() const;
128   const ObjectFile *getObjectFile() const;
129 };
130 typedef content_iterator<RelocationRef> relocation_iterator;
131
132 /// SectionRef - This is a value type class that represents a single section in
133 /// the list of sections in the object file.
134 class SectionRef;
135 typedef content_iterator<SectionRef> section_iterator;
136 class SectionRef {
137   friend class SymbolRef;
138   DataRefImpl SectionPimpl;
139   const ObjectFile *OwningObject;
140
141 public:
142   SectionRef() : OwningObject(NULL) { }
143
144   SectionRef(DataRefImpl SectionP, const ObjectFile *Owner);
145
146   bool operator==(const SectionRef &Other) const;
147   bool operator<(const SectionRef &Other) const;
148
149   error_code getNext(SectionRef &Result) const;
150
151   error_code getName(StringRef &Result) const;
152   error_code getAddress(uint64_t &Result) const;
153   error_code getSize(uint64_t &Result) const;
154   error_code getContents(StringRef &Result) const;
155
156   /// @brief Get the alignment of this section as the actual value (not log 2).
157   error_code getAlignment(uint64_t &Result) const;
158
159   // FIXME: Move to the normalization layer when it's created.
160   error_code isText(bool &Result) const;
161   error_code isData(bool &Result) const;
162   error_code isBSS(bool &Result) const;
163   error_code isRequiredForExecution(bool &Result) const;
164   error_code isVirtual(bool &Result) const;
165   error_code isZeroInit(bool &Result) const;
166   error_code isReadOnlyData(bool &Result) const;
167
168   error_code containsSymbol(SymbolRef S, bool &Result) const;
169
170   relocation_iterator begin_relocations() const;
171   relocation_iterator end_relocations() const;
172   section_iterator getRelocatedSection() const;
173
174   DataRefImpl getRawDataRefImpl() const;
175 };
176
177 /// SymbolRef - This is a value type class that represents a single symbol in
178 /// the list of symbols in the object file.
179 class SymbolRef {
180   friend class SectionRef;
181   DataRefImpl SymbolPimpl;
182   const ObjectFile *OwningObject;
183
184 public:
185   SymbolRef() : OwningObject(NULL) { }
186
187   enum Type {
188     ST_Unknown, // Type not specified
189     ST_Data,
190     ST_Debug,
191     ST_File,
192     ST_Function,
193     ST_Other
194   };
195
196   enum Flags LLVM_ENUM_INT_TYPE(unsigned) {
197     SF_None            = 0,
198     SF_Undefined       = 1U << 0,  // Symbol is defined in another object file
199     SF_Global          = 1U << 1,  // Global symbol
200     SF_Weak            = 1U << 2,  // Weak symbol
201     SF_Absolute        = 1U << 3,  // Absolute symbol
202     SF_ThreadLocal     = 1U << 4,  // Thread local symbol
203     SF_Common          = 1U << 5,  // Symbol has common linkage
204     SF_FormatSpecific  = 1U << 31  // Specific to the object file format
205                                    // (e.g. section symbols)
206   };
207
208   SymbolRef(DataRefImpl SymbolP, const ObjectFile *Owner);
209
210   bool operator==(const SymbolRef &Other) const;
211   bool operator<(const SymbolRef &Other) const;
212
213   error_code getNext(SymbolRef &Result) const;
214
215   error_code getName(StringRef &Result) const;
216   /// Returns the symbol virtual address (i.e. address at which it will be
217   /// mapped).
218   error_code getAddress(uint64_t &Result) const;
219   error_code getFileOffset(uint64_t &Result) const;
220   /// @brief Get the alignment of this symbol as the actual value (not log 2).
221   error_code getAlignment(uint32_t &Result) const;
222   error_code getSize(uint64_t &Result) const;
223   error_code getType(SymbolRef::Type &Result) const;
224
225   /// Get symbol flags (bitwise OR of SymbolRef::Flags)
226   error_code getFlags(uint32_t &Result) const;
227
228   /// @brief Get section this symbol is defined in reference to. Result is
229   /// end_sections() if it is undefined or is an absolute symbol.
230   error_code getSection(section_iterator &Result) const;
231
232   /// @brief Get value of the symbol in the symbol table.
233   error_code getValue(uint64_t &Val) const;
234
235   DataRefImpl getRawDataRefImpl() const;
236 };
237
238 /// LibraryRef - This is a value type class that represents a single library in
239 /// the list of libraries needed by a shared or dynamic object.
240 class LibraryRef {
241   friend class SectionRef;
242   DataRefImpl LibraryPimpl;
243   const ObjectFile *OwningObject;
244
245 public:
246   LibraryRef() : OwningObject(NULL) { }
247
248   LibraryRef(DataRefImpl LibraryP, const ObjectFile *Owner);
249
250   bool operator==(const LibraryRef &Other) const;
251   bool operator<(const LibraryRef &Other) const;
252
253   error_code getNext(LibraryRef &Result) const;
254
255   // Get the path to this library, as stored in the object file.
256   error_code getPath(StringRef &Result) const;
257
258   DataRefImpl getRawDataRefImpl() const;
259 };
260 typedef content_iterator<LibraryRef> library_iterator;
261
262 const uint64_t UnknownAddressOrSize = ~0ULL;
263
264 /// ObjectFile - This class is the base class for all object file types.
265 /// Concrete instances of this object are created by createObjectFile, which
266 /// figures out which type to create.
267 class ObjectFile : public Binary {
268   virtual void anchor();
269   ObjectFile() LLVM_DELETED_FUNCTION;
270   ObjectFile(const ObjectFile &other) LLVM_DELETED_FUNCTION;
271
272 protected:
273   ObjectFile(unsigned int Type, MemoryBuffer *Source, bool BufferOwned = true);
274
275   const uint8_t *base() const {
276     return reinterpret_cast<const uint8_t *>(Data->getBufferStart());
277   }
278
279   // These functions are for SymbolRef to call internally. The main goal of
280   // this is to allow SymbolRef::SymbolPimpl to point directly to the symbol
281   // entry in the memory mapped object file. SymbolPimpl cannot contain any
282   // virtual functions because then it could not point into the memory mapped
283   // file.
284   //
285   // Implementations assume that the DataRefImpl is valid and has not been
286   // modified externally. It's UB otherwise.
287   friend class SymbolRef;
288   virtual error_code getSymbolNext(DataRefImpl Symb, SymbolRef &Res) const = 0;
289   virtual error_code getSymbolName(DataRefImpl Symb, StringRef &Res) const = 0;
290   virtual error_code getSymbolAddress(DataRefImpl Symb, uint64_t &Res) const = 0;
291   virtual error_code getSymbolFileOffset(DataRefImpl Symb, uint64_t &Res)const=0;
292   virtual error_code getSymbolAlignment(DataRefImpl Symb, uint32_t &Res) const;
293   virtual error_code getSymbolSize(DataRefImpl Symb, uint64_t &Res) const = 0;
294   virtual error_code getSymbolType(DataRefImpl Symb,
295                                    SymbolRef::Type &Res) const = 0;
296   virtual error_code getSymbolFlags(DataRefImpl Symb,
297                                     uint32_t &Res) const = 0;
298   virtual error_code getSymbolSection(DataRefImpl Symb,
299                                       section_iterator &Res) const = 0;
300   virtual error_code getSymbolValue(DataRefImpl Symb, uint64_t &Val) const = 0;
301
302   // Same as above for SectionRef.
303   friend class SectionRef;
304   virtual error_code getSectionNext(DataRefImpl Sec, SectionRef &Res) const = 0;
305   virtual error_code getSectionName(DataRefImpl Sec, StringRef &Res) const = 0;
306   virtual error_code getSectionAddress(DataRefImpl Sec, uint64_t &Res) const =0;
307   virtual error_code getSectionSize(DataRefImpl Sec, uint64_t &Res) const = 0;
308   virtual error_code getSectionContents(DataRefImpl Sec, StringRef &Res)const=0;
309   virtual error_code getSectionAlignment(DataRefImpl Sec, uint64_t &Res)const=0;
310   virtual error_code isSectionText(DataRefImpl Sec, bool &Res) const = 0;
311   virtual error_code isSectionData(DataRefImpl Sec, bool &Res) const = 0;
312   virtual error_code isSectionBSS(DataRefImpl Sec, bool &Res) const = 0;
313   virtual error_code isSectionRequiredForExecution(DataRefImpl Sec,
314                                                    bool &Res) const = 0;
315   // A section is 'virtual' if its contents aren't present in the object image.
316   virtual error_code isSectionVirtual(DataRefImpl Sec, bool &Res) const = 0;
317   virtual error_code isSectionZeroInit(DataRefImpl Sec, bool &Res) const = 0;
318   virtual error_code isSectionReadOnlyData(DataRefImpl Sec, bool &Res) const =0;
319   virtual error_code sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb,
320                                            bool &Result) const = 0;
321   virtual relocation_iterator section_rel_begin(DataRefImpl Sec) const = 0;
322   virtual relocation_iterator section_rel_end(DataRefImpl Sec) const = 0;
323   virtual section_iterator getRelocatedSection(DataRefImpl Sec) const;
324
325   // Same as above for RelocationRef.
326   friend class RelocationRef;
327   virtual error_code getRelocationNext(DataRefImpl Rel,
328                                        RelocationRef &Res) const = 0;
329   virtual error_code getRelocationAddress(DataRefImpl Rel,
330                                           uint64_t &Res) const =0;
331   virtual error_code getRelocationOffset(DataRefImpl Rel,
332                                          uint64_t &Res) const =0;
333   virtual symbol_iterator getRelocationSymbol(DataRefImpl Rel) const = 0;
334   virtual error_code getRelocationType(DataRefImpl Rel,
335                                        uint64_t &Res) const = 0;
336   virtual error_code getRelocationTypeName(DataRefImpl Rel,
337                                        SmallVectorImpl<char> &Result) const = 0;
338   virtual error_code getRelocationValueString(DataRefImpl Rel,
339                                        SmallVectorImpl<char> &Result) const = 0;
340   virtual error_code getRelocationHidden(DataRefImpl Rel, bool &Result) const {
341     Result = false;
342     return object_error::success;
343   }
344
345   // Same for LibraryRef
346   friend class LibraryRef;
347   virtual error_code getLibraryNext(DataRefImpl Lib, LibraryRef &Res) const = 0;
348   virtual error_code getLibraryPath(DataRefImpl Lib, StringRef &Res) const = 0;
349
350 public:
351
352   virtual symbol_iterator begin_symbols() const = 0;
353   virtual symbol_iterator end_symbols() const = 0;
354
355   virtual symbol_iterator begin_dynamic_symbols() const = 0;
356   virtual symbol_iterator end_dynamic_symbols() const = 0;
357
358   virtual section_iterator begin_sections() const = 0;
359   virtual section_iterator end_sections() const = 0;
360
361   virtual library_iterator begin_libraries_needed() const = 0;
362   virtual library_iterator end_libraries_needed() const = 0;
363
364   /// @brief The number of bytes used to represent an address in this object
365   ///        file format.
366   virtual uint8_t getBytesInAddress() const = 0;
367
368   virtual StringRef getFileFormatName() const = 0;
369   virtual /* Triple::ArchType */ unsigned getArch() const = 0;
370
371   /// For shared objects, returns the name which this object should be
372   /// loaded from at runtime. This corresponds to DT_SONAME on ELF and
373   /// LC_ID_DYLIB (install name) on MachO.
374   virtual StringRef getLoadName() const = 0;
375
376   /// @returns Pointer to ObjectFile subclass to handle this type of object.
377   /// @param ObjectPath The path to the object file. ObjectPath.isObject must
378   ///        return true.
379   /// @brief Create ObjectFile from path.
380   static ErrorOr<ObjectFile *> createObjectFile(StringRef ObjectPath);
381   static ErrorOr<ObjectFile *>
382   createObjectFile(MemoryBuffer *Object, bool BufferOwned = true,
383                    sys::fs::file_magic Type = sys::fs::file_magic::unknown);
384
385   static inline bool classof(const Binary *v) {
386     return v->isObject();
387   }
388
389 public:
390   static ErrorOr<ObjectFile *> createCOFFObjectFile(MemoryBuffer *Object,
391                                                     bool BufferOwned = true);
392   static ErrorOr<ObjectFile *> createELFObjectFile(MemoryBuffer *Object,
393                                                    bool BufferOwned = true);
394   static ErrorOr<ObjectFile *> createMachOObjectFile(MemoryBuffer *Object,
395                                                      bool BufferOwned = true);
396 };
397
398 // Inline function definitions.
399 inline SymbolRef::SymbolRef(DataRefImpl SymbolP, const ObjectFile *Owner)
400   : SymbolPimpl(SymbolP)
401   , OwningObject(Owner) {}
402
403 inline bool SymbolRef::operator==(const SymbolRef &Other) const {
404   return SymbolPimpl == Other.SymbolPimpl;
405 }
406
407 inline bool SymbolRef::operator<(const SymbolRef &Other) const {
408   return SymbolPimpl < Other.SymbolPimpl;
409 }
410
411 inline error_code SymbolRef::getNext(SymbolRef &Result) const {
412   return OwningObject->getSymbolNext(SymbolPimpl, Result);
413 }
414
415 inline error_code SymbolRef::getName(StringRef &Result) const {
416   return OwningObject->getSymbolName(SymbolPimpl, Result);
417 }
418
419 inline error_code SymbolRef::getAddress(uint64_t &Result) const {
420   return OwningObject->getSymbolAddress(SymbolPimpl, Result);
421 }
422
423 inline error_code SymbolRef::getFileOffset(uint64_t &Result) const {
424   return OwningObject->getSymbolFileOffset(SymbolPimpl, Result);
425 }
426
427 inline error_code SymbolRef::getAlignment(uint32_t &Result) const {
428   return OwningObject->getSymbolAlignment(SymbolPimpl, Result);
429 }
430
431 inline error_code SymbolRef::getSize(uint64_t &Result) const {
432   return OwningObject->getSymbolSize(SymbolPimpl, Result);
433 }
434
435 inline error_code SymbolRef::getFlags(uint32_t &Result) const {
436   return OwningObject->getSymbolFlags(SymbolPimpl, Result);
437 }
438
439 inline error_code SymbolRef::getSection(section_iterator &Result) const {
440   return OwningObject->getSymbolSection(SymbolPimpl, Result);
441 }
442
443 inline error_code SymbolRef::getType(SymbolRef::Type &Result) const {
444   return OwningObject->getSymbolType(SymbolPimpl, Result);
445 }
446
447 inline error_code SymbolRef::getValue(uint64_t &Val) const {
448   return OwningObject->getSymbolValue(SymbolPimpl, Val);
449 }
450
451 inline DataRefImpl SymbolRef::getRawDataRefImpl() const {
452   return SymbolPimpl;
453 }
454
455
456 /// SectionRef
457 inline SectionRef::SectionRef(DataRefImpl SectionP,
458                               const ObjectFile *Owner)
459   : SectionPimpl(SectionP)
460   , OwningObject(Owner) {}
461
462 inline bool SectionRef::operator==(const SectionRef &Other) const {
463   return SectionPimpl == Other.SectionPimpl;
464 }
465
466 inline bool SectionRef::operator<(const SectionRef &Other) const {
467   return SectionPimpl < Other.SectionPimpl;
468 }
469
470 inline error_code SectionRef::getNext(SectionRef &Result) const {
471   return OwningObject->getSectionNext(SectionPimpl, Result);
472 }
473
474 inline error_code SectionRef::getName(StringRef &Result) const {
475   return OwningObject->getSectionName(SectionPimpl, Result);
476 }
477
478 inline error_code SectionRef::getAddress(uint64_t &Result) const {
479   return OwningObject->getSectionAddress(SectionPimpl, Result);
480 }
481
482 inline error_code SectionRef::getSize(uint64_t &Result) const {
483   return OwningObject->getSectionSize(SectionPimpl, Result);
484 }
485
486 inline error_code SectionRef::getContents(StringRef &Result) const {
487   return OwningObject->getSectionContents(SectionPimpl, Result);
488 }
489
490 inline error_code SectionRef::getAlignment(uint64_t &Result) const {
491   return OwningObject->getSectionAlignment(SectionPimpl, Result);
492 }
493
494 inline error_code SectionRef::isText(bool &Result) const {
495   return OwningObject->isSectionText(SectionPimpl, Result);
496 }
497
498 inline error_code SectionRef::isData(bool &Result) const {
499   return OwningObject->isSectionData(SectionPimpl, Result);
500 }
501
502 inline error_code SectionRef::isBSS(bool &Result) const {
503   return OwningObject->isSectionBSS(SectionPimpl, Result);
504 }
505
506 inline error_code SectionRef::isRequiredForExecution(bool &Result) const {
507   return OwningObject->isSectionRequiredForExecution(SectionPimpl, Result);
508 }
509
510 inline error_code SectionRef::isVirtual(bool &Result) const {
511   return OwningObject->isSectionVirtual(SectionPimpl, Result);
512 }
513
514 inline error_code SectionRef::isZeroInit(bool &Result) const {
515   return OwningObject->isSectionZeroInit(SectionPimpl, Result);
516 }
517
518 inline error_code SectionRef::isReadOnlyData(bool &Result) const {
519   return OwningObject->isSectionReadOnlyData(SectionPimpl, Result);
520 }
521
522 inline error_code SectionRef::containsSymbol(SymbolRef S, bool &Result) const {
523   return OwningObject->sectionContainsSymbol(SectionPimpl, S.SymbolPimpl,
524                                              Result);
525 }
526
527 inline relocation_iterator SectionRef::begin_relocations() const {
528   return OwningObject->section_rel_begin(SectionPimpl);
529 }
530
531 inline relocation_iterator SectionRef::end_relocations() const {
532   return OwningObject->section_rel_end(SectionPimpl);
533 }
534
535 inline section_iterator SectionRef::getRelocatedSection() const {
536   return OwningObject->getRelocatedSection(SectionPimpl);
537 }
538
539 inline DataRefImpl SectionRef::getRawDataRefImpl() const {
540   return SectionPimpl;
541 }
542
543 /// RelocationRef
544 inline RelocationRef::RelocationRef(DataRefImpl RelocationP,
545                               const ObjectFile *Owner)
546   : RelocationPimpl(RelocationP)
547   , OwningObject(Owner) {}
548
549 inline bool RelocationRef::operator==(const RelocationRef &Other) const {
550   return RelocationPimpl == Other.RelocationPimpl;
551 }
552
553 inline error_code RelocationRef::getNext(RelocationRef &Result) const {
554   return OwningObject->getRelocationNext(RelocationPimpl, Result);
555 }
556
557 inline error_code RelocationRef::getAddress(uint64_t &Result) const {
558   return OwningObject->getRelocationAddress(RelocationPimpl, Result);
559 }
560
561 inline error_code RelocationRef::getOffset(uint64_t &Result) const {
562   return OwningObject->getRelocationOffset(RelocationPimpl, Result);
563 }
564
565 inline symbol_iterator RelocationRef::getSymbol() const {
566   return OwningObject->getRelocationSymbol(RelocationPimpl);
567 }
568
569 inline error_code RelocationRef::getType(uint64_t &Result) const {
570   return OwningObject->getRelocationType(RelocationPimpl, Result);
571 }
572
573 inline error_code RelocationRef::getTypeName(SmallVectorImpl<char> &Result)
574   const {
575   return OwningObject->getRelocationTypeName(RelocationPimpl, Result);
576 }
577
578 inline error_code RelocationRef::getValueString(SmallVectorImpl<char> &Result)
579   const {
580   return OwningObject->getRelocationValueString(RelocationPimpl, Result);
581 }
582
583 inline error_code RelocationRef::getHidden(bool &Result) const {
584   return OwningObject->getRelocationHidden(RelocationPimpl, Result);
585 }
586
587 inline DataRefImpl RelocationRef::getRawDataRefImpl() const {
588   return RelocationPimpl;
589 }
590
591 inline const ObjectFile *RelocationRef::getObjectFile() const {
592   return OwningObject;
593 }
594
595 // Inline function definitions.
596 inline LibraryRef::LibraryRef(DataRefImpl LibraryP, const ObjectFile *Owner)
597   : LibraryPimpl(LibraryP)
598   , OwningObject(Owner) {}
599
600 inline bool LibraryRef::operator==(const LibraryRef &Other) const {
601   return LibraryPimpl == Other.LibraryPimpl;
602 }
603
604 inline bool LibraryRef::operator<(const LibraryRef &Other) const {
605   return LibraryPimpl < Other.LibraryPimpl;
606 }
607
608 inline error_code LibraryRef::getNext(LibraryRef &Result) const {
609   return OwningObject->getLibraryNext(LibraryPimpl, Result);
610 }
611
612 inline error_code LibraryRef::getPath(StringRef &Result) const {
613   return OwningObject->getLibraryPath(LibraryPimpl, Result);
614 }
615
616 } // end namespace object
617 } // end namespace llvm
618
619 #endif