Bug Summary

File:include/llvm/Object/ObjectFile.h
Warning:line 417, column 10
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name TestingSupport.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -ffunction-sections -fdata-sections -resource-dir /usr/lib/llvm-8/lib/clang/8.0.0 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I /build/llvm-toolchain-snapshot-8~svn345461/build-llvm/tools/llvm-cov -I /build/llvm-toolchain-snapshot-8~svn345461/tools/llvm-cov -I /build/llvm-toolchain-snapshot-8~svn345461/build-llvm/include -I /build/llvm-toolchain-snapshot-8~svn345461/include -U NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/x86_64-linux-gnu/c++/6.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/backward -internal-isystem /usr/include/clang/8.0.0/include/ -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-8/lib/clang/8.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /build/llvm-toolchain-snapshot-8~svn345461/build-llvm/tools/llvm-cov -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -analyzer-output=html -analyzer-config stable-report-filename=true -o /tmp/scan-build-2018-10-27-211344-32123-1 -x c++ /build/llvm-toolchain-snapshot-8~svn345461/tools/llvm-cov/TestingSupport.cpp -faddrsig

/build/llvm-toolchain-snapshot-8~svn345461/tools/llvm-cov/TestingSupport.cpp

1//===- TestingSupport.cpp - Convert objects files into test files --------===//
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#include "llvm/Object/ObjectFile.h"
11#include "llvm/ProfileData/InstrProf.h"
12#include "llvm/Support/CommandLine.h"
13#include "llvm/Support/LEB128.h"
14#include "llvm/Support/raw_ostream.h"
15#include <functional>
16#include <system_error>
17
18using namespace llvm;
19using namespace object;
20
21int convertForTestingMain(int argc, const char *argv[]) {
22 cl::opt<std::string> InputSourceFile(cl::Positional, cl::Required,
23 cl::desc("<Source file>"));
24
25 cl::opt<std::string> OutputFilename(
26 "o", cl::Required,
27 cl::desc(
28 "File with the profile data obtained after an instrumented run"));
29
30 cl::ParseCommandLineOptions(argc, argv, "LLVM code coverage tool\n");
31
32 auto ObjErr = llvm::object::ObjectFile::createObjectFile(InputSourceFile);
33 if (!ObjErr) {
1
Taking false branch
34 std::string Buf;
35 raw_string_ostream OS(Buf);
36 logAllUnhandledErrors(ObjErr.takeError(), OS, "");
37 OS.flush();
38 errs() << "error: " << Buf;
39 return 1;
40 }
41 ObjectFile *OF = ObjErr.get().getBinary();
42 auto BytesInAddress = OF->getBytesInAddress();
43 if (BytesInAddress != 8) {
2
Assuming 'BytesInAddress' is equal to 8
3
Taking false branch
44 errs() << "error: 64 bit binary expected\n";
45 return 1;
46 }
47
48 // Look for the sections that we are interested in.
49 int FoundSectionCount = 0;
50 SectionRef ProfileNames, CoverageMapping;
4
Calling defaulted default constructor for 'SectionRef'
6
Returning from default constructor for 'SectionRef'
51 auto ObjFormat = OF->getTripleObjectFormat();
52 for (const auto &Section : OF->sections()) {
53 StringRef Name;
54 if (Section.getName(Name))
7
Taking false branch
10
Taking false branch
55 return 1;
56 if (Name == llvm::getInstrProfSectionName(IPSK_name, ObjFormat,
8
Assuming the condition is true
9
Taking true branch
11
Assuming the condition is true
12
Taking true branch
57 /*AddSegmentInfo=*/false)) {
58 ProfileNames = Section;
59 } else if (Name == llvm::getInstrProfSectionName(
60 IPSK_covmap, ObjFormat, /*AddSegmentInfo=*/false)) {
61 CoverageMapping = Section;
62 } else
63 continue;
64 ++FoundSectionCount;
65 }
66 if (FoundSectionCount != 2)
13
Taking false branch
67 return 1;
68
69 // Get the contents of the given sections.
70 uint64_t ProfileNamesAddress = ProfileNames.getAddress();
71 StringRef CoverageMappingData;
72 StringRef ProfileNamesData;
73 if (CoverageMapping.getContents(CoverageMappingData) ||
14
Calling 'SectionRef::getContents'
74 ProfileNames.getContents(ProfileNamesData))
75 return 1;
76
77 int FD;
78 if (auto Err = sys::fs::openFileForWrite(OutputFilename, FD)) {
79 errs() << "error: " << Err.message() << "\n";
80 return 1;
81 }
82
83 raw_fd_ostream OS(FD, true);
84 OS << "llvmcovmtestdata";
85 encodeULEB128(ProfileNamesData.size(), OS);
86 encodeULEB128(ProfileNamesAddress, OS);
87 OS << ProfileNamesData;
88 // Coverage mapping data is expected to have an alignment of 8.
89 for (unsigned Pad = OffsetToAlignment(OS.tell(), 8); Pad; --Pad)
90 OS.write(uint8_t(0));
91 OS << CoverageMappingData;
92
93 return 0;
94}

/build/llvm-toolchain-snapshot-8~svn345461/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/ADT/Triple.h"
19#include "llvm/ADT/iterator_range.h"
20#include "llvm/BinaryFormat/Magic.h"
21#include "llvm/MC/SubtargetFeature.h"
22#include "llvm/Object/Binary.h"
23#include "llvm/Object/Error.h"
24#include "llvm/Object/SymbolicFile.h"
25#include "llvm/Support/Casting.h"
26#include "llvm/Support/Error.h"
27#include "llvm/Support/FileSystem.h"
28#include "llvm/Support/MemoryBuffer.h"
29#include <cassert>
30#include <cstdint>
31#include <memory>
32#include <system_error>
33
34namespace llvm {
35
36class ARMAttributeParser;
37
38namespace object {
39
40class COFFObjectFile;
41class MachOObjectFile;
42class ObjectFile;
43class SectionRef;
44class SymbolRef;
45class symbol_iterator;
46class WasmObjectFile;
47
48using section_iterator = content_iterator<SectionRef>;
49
50/// This is a value type class that represents a single relocation in the list
51/// of relocations in the object file.
52class RelocationRef {
53 DataRefImpl RelocationPimpl;
54 const ObjectFile *OwningObject = nullptr;
55
56public:
57 RelocationRef() = default;
58 RelocationRef(DataRefImpl RelocationP, const ObjectFile *Owner);
59
60 bool operator==(const RelocationRef &Other) const;
61
62 void moveNext();
63
64 uint64_t getOffset() const;
65 symbol_iterator getSymbol() const;
66 uint64_t getType() const;
67
68 /// Get a string that represents the type of this relocation.
69 ///
70 /// This is for display purposes only.
71 void getTypeName(SmallVectorImpl<char> &Result) const;
72
73 DataRefImpl getRawDataRefImpl() const;
74 const ObjectFile *getObject() const;
75};
76
77using relocation_iterator = content_iterator<RelocationRef>;
78
79/// This is a value type class that represents a single section in the list of
80/// sections in the object file.
81class SectionRef {
82 friend class SymbolRef;
83
84 DataRefImpl SectionPimpl;
85 const ObjectFile *OwningObject = nullptr;
5
Null pointer value stored to 'CoverageMapping.OwningObject'
86
87public:
88 SectionRef() = default;
89 SectionRef(DataRefImpl SectionP, const ObjectFile *Owner);
90
91 bool operator==(const SectionRef &Other) const;
92 bool operator!=(const SectionRef &Other) const;
93 bool operator<(const SectionRef &Other) const;
94
95 void moveNext();
96
97 std::error_code getName(StringRef &Result) const;
98 uint64_t getAddress() const;
99 uint64_t getIndex() const;
100 uint64_t getSize() const;
101 std::error_code getContents(StringRef &Result) const;
102
103 /// Get the alignment of this section as the actual value (not log 2).
104 uint64_t getAlignment() const;
105
106 bool isCompressed() const;
107 bool isText() const;
108 bool isData() const;
109 bool isBSS() const;
110 bool isVirtual() const;
111 bool isBitcode() const;
112 bool isStripped() const;
113
114 bool containsSymbol(SymbolRef S) const;
115
116 relocation_iterator relocation_begin() const;
117 relocation_iterator relocation_end() const;
118 iterator_range<relocation_iterator> relocations() const {
119 return make_range(relocation_begin(), relocation_end());
120 }
121 section_iterator getRelocatedSection() const;
122
123 DataRefImpl getRawDataRefImpl() const;
124 const ObjectFile *getObject() const;
125};
126
127/// This is a value type class that represents a single symbol in the list of
128/// symbols in the object file.
129class SymbolRef : public BasicSymbolRef {
130 friend class SectionRef;
131
132public:
133 enum Type {
134 ST_Unknown, // Type not specified
135 ST_Data,
136 ST_Debug,
137 ST_File,
138 ST_Function,
139 ST_Other
140 };
141
142 SymbolRef() = default;
143 SymbolRef(DataRefImpl SymbolP, const ObjectFile *Owner);
144 SymbolRef(const BasicSymbolRef &B) : BasicSymbolRef(B) {
145 assert(isa<ObjectFile>(BasicSymbolRef::getObject()))((isa<ObjectFile>(BasicSymbolRef::getObject())) ? static_cast
<void> (0) : __assert_fail ("isa<ObjectFile>(BasicSymbolRef::getObject())"
, "/build/llvm-toolchain-snapshot-8~svn345461/include/llvm/Object/ObjectFile.h"
, 145, __PRETTY_FUNCTION__))
;
146 }
147
148 Expected<StringRef> getName() const;
149 /// Returns the symbol virtual address (i.e. address at which it will be
150 /// mapped).
151 Expected<uint64_t> getAddress() const;
152
153 /// Return the value of the symbol depending on the object this can be an
154 /// offset or a virtual address.
155 uint64_t getValue() const;
156
157 /// Get the alignment of this symbol as the actual value (not log 2).
158 uint32_t getAlignment() const;
159 uint64_t getCommonSize() const;
160 Expected<SymbolRef::Type> getType() const;
161
162 /// Get section this symbol is defined in reference to. Result is
163 /// end_sections() if it is undefined or is an absolute symbol.
164 Expected<section_iterator> getSection() const;
165
166 const ObjectFile *getObject() const;
167};
168
169class symbol_iterator : public basic_symbol_iterator {
170public:
171 symbol_iterator(SymbolRef Sym) : basic_symbol_iterator(Sym) {}
172 symbol_iterator(const basic_symbol_iterator &B)
173 : basic_symbol_iterator(SymbolRef(B->getRawDataRefImpl(),
174 cast<ObjectFile>(B->getObject()))) {}
175
176 const SymbolRef *operator->() const {
177 const BasicSymbolRef &P = basic_symbol_iterator::operator *();
178 return static_cast<const SymbolRef*>(&P);
179 }
180
181 const SymbolRef &operator*() const {
182 const BasicSymbolRef &P = basic_symbol_iterator::operator *();
183 return static_cast<const SymbolRef&>(P);
184 }
185};
186
187/// This class is the base class for all object file types. Concrete instances
188/// of this object are created by createObjectFile, which figures out which type
189/// to create.
190class ObjectFile : public SymbolicFile {
191 virtual void anchor();
192
193protected:
194 ObjectFile(unsigned int Type, MemoryBufferRef Source);
195
196 const uint8_t *base() const {
197 return reinterpret_cast<const uint8_t *>(Data.getBufferStart());
198 }
199
200 // These functions are for SymbolRef to call internally. The main goal of
201 // this is to allow SymbolRef::SymbolPimpl to point directly to the symbol
202 // entry in the memory mapped object file. SymbolPimpl cannot contain any
203 // virtual functions because then it could not point into the memory mapped
204 // file.
205 //
206 // Implementations assume that the DataRefImpl is valid and has not been
207 // modified externally. It's UB otherwise.
208 friend class SymbolRef;
209
210 virtual Expected<StringRef> getSymbolName(DataRefImpl Symb) const = 0;
211 std::error_code printSymbolName(raw_ostream &OS,
212 DataRefImpl Symb) const override;
213 virtual Expected<uint64_t> getSymbolAddress(DataRefImpl Symb) const = 0;
214 virtual uint64_t getSymbolValueImpl(DataRefImpl Symb) const = 0;
215 virtual uint32_t getSymbolAlignment(DataRefImpl Symb) const;
216 virtual uint64_t getCommonSymbolSizeImpl(DataRefImpl Symb) const = 0;
217 virtual Expected<SymbolRef::Type> getSymbolType(DataRefImpl Symb) const = 0;
218 virtual Expected<section_iterator>
219 getSymbolSection(DataRefImpl Symb) const = 0;
220
221 // Same as above for SectionRef.
222 friend class SectionRef;
223
224 virtual void moveSectionNext(DataRefImpl &Sec) const = 0;
225 virtual std::error_code getSectionName(DataRefImpl Sec,
226 StringRef &Res) const = 0;
227 virtual uint64_t getSectionAddress(DataRefImpl Sec) const = 0;
228 virtual uint64_t getSectionIndex(DataRefImpl Sec) const = 0;
229 virtual uint64_t getSectionSize(DataRefImpl Sec) const = 0;
230 virtual std::error_code getSectionContents(DataRefImpl Sec,
231 StringRef &Res) const = 0;
232 virtual uint64_t getSectionAlignment(DataRefImpl Sec) const = 0;
233 virtual bool isSectionCompressed(DataRefImpl Sec) const = 0;
234 virtual bool isSectionText(DataRefImpl Sec) const = 0;
235 virtual bool isSectionData(DataRefImpl Sec) const = 0;
236 virtual bool isSectionBSS(DataRefImpl Sec) const = 0;
237 // A section is 'virtual' if its contents aren't present in the object image.
238 virtual bool isSectionVirtual(DataRefImpl Sec) const = 0;
239 virtual bool isSectionBitcode(DataRefImpl Sec) const;
240 virtual bool isSectionStripped(DataRefImpl Sec) const;
241 virtual relocation_iterator section_rel_begin(DataRefImpl Sec) const = 0;
242 virtual relocation_iterator section_rel_end(DataRefImpl Sec) const = 0;
243 virtual section_iterator getRelocatedSection(DataRefImpl Sec) const;
244
245 // Same as above for RelocationRef.
246 friend class RelocationRef;
247 virtual void moveRelocationNext(DataRefImpl &Rel) const = 0;
248 virtual uint64_t getRelocationOffset(DataRefImpl Rel) const = 0;
249 virtual symbol_iterator getRelocationSymbol(DataRefImpl Rel) const = 0;
250 virtual uint64_t getRelocationType(DataRefImpl Rel) const = 0;
251 virtual void getRelocationTypeName(DataRefImpl Rel,
252 SmallVectorImpl<char> &Result) const = 0;
253
254 uint64_t getSymbolValue(DataRefImpl Symb) const;
255
256public:
257 ObjectFile() = delete;
258 ObjectFile(const ObjectFile &other) = delete;
259
260 uint64_t getCommonSymbolSize(DataRefImpl Symb) const {
261 assert(getSymbolFlags(Symb) & SymbolRef::SF_Common)((getSymbolFlags(Symb) & SymbolRef::SF_Common) ? static_cast
<void> (0) : __assert_fail ("getSymbolFlags(Symb) & SymbolRef::SF_Common"
, "/build/llvm-toolchain-snapshot-8~svn345461/include/llvm/Object/ObjectFile.h"
, 261, __PRETTY_FUNCTION__))
;
262 return getCommonSymbolSizeImpl(Symb);
263 }
264
265 virtual std::vector<SectionRef> dynamic_relocation_sections() const {
266 return std::vector<SectionRef>();
267 }
268
269 using symbol_iterator_range = iterator_range<symbol_iterator>;
270 symbol_iterator_range symbols() const {
271 return symbol_iterator_range(symbol_begin(), symbol_end());
272 }
273
274 virtual section_iterator section_begin() const = 0;
275 virtual section_iterator section_end() const = 0;
276
277 using section_iterator_range = iterator_range<section_iterator>;
278 section_iterator_range sections() const {
279 return section_iterator_range(section_begin(), section_end());
280 }
281
282 /// The number of bytes used to represent an address in this object
283 /// file format.
284 virtual uint8_t getBytesInAddress() const = 0;
285
286 virtual StringRef getFileFormatName() const = 0;
287 virtual Triple::ArchType getArch() const = 0;
288 virtual SubtargetFeatures getFeatures() const = 0;
289 virtual void setARMSubArch(Triple &TheTriple) const { }
290 virtual Expected<uint64_t> getStartAddress() const {
291 return errorCodeToError(object_error::parse_failed);
292 };
293
294 /// Create a triple from the data in this object file.
295 Triple makeTriple() const;
296
297 virtual std::error_code
298 getBuildAttributes(ARMAttributeParser &Attributes) const {
299 return std::error_code();
300 }
301
302 /// Maps a debug section name to a standard DWARF section name.
303 virtual StringRef mapDebugSectionName(StringRef Name) const { return Name; }
304
305 /// True if this is a relocatable object (.o/.obj).
306 virtual bool isRelocatableObject() const = 0;
307
308 /// @returns Pointer to ObjectFile subclass to handle this type of object.
309 /// @param ObjectPath The path to the object file. ObjectPath.isObject must
310 /// return true.
311 /// Create ObjectFile from path.
312 static Expected<OwningBinary<ObjectFile>>
313 createObjectFile(StringRef ObjectPath);
314
315 static Expected<std::unique_ptr<ObjectFile>>
316 createObjectFile(MemoryBufferRef Object, llvm::file_magic Type);
317 static Expected<std::unique_ptr<ObjectFile>>
318 createObjectFile(MemoryBufferRef Object) {
319 return createObjectFile(Object, llvm::file_magic::unknown);
320 }
321
322 static bool classof(const Binary *v) {
323 return v->isObject();
324 }
325
326 static Expected<std::unique_ptr<COFFObjectFile>>
327 createCOFFObjectFile(MemoryBufferRef Object);
328
329 static Expected<std::unique_ptr<ObjectFile>>
330 createELFObjectFile(MemoryBufferRef Object);
331
332 static Expected<std::unique_ptr<MachOObjectFile>>
333 createMachOObjectFile(MemoryBufferRef Object,
334 uint32_t UniversalCputype = 0,
335 uint32_t UniversalIndex = 0);
336
337 static Expected<std::unique_ptr<WasmObjectFile>>
338 createWasmObjectFile(MemoryBufferRef Object);
339};
340
341// Inline function definitions.
342inline SymbolRef::SymbolRef(DataRefImpl SymbolP, const ObjectFile *Owner)
343 : BasicSymbolRef(SymbolP, Owner) {}
344
345inline Expected<StringRef> SymbolRef::getName() const {
346 return getObject()->getSymbolName(getRawDataRefImpl());
347}
348
349inline Expected<uint64_t> SymbolRef::getAddress() const {
350 return getObject()->getSymbolAddress(getRawDataRefImpl());
351}
352
353inline uint64_t SymbolRef::getValue() const {
354 return getObject()->getSymbolValue(getRawDataRefImpl());
355}
356
357inline uint32_t SymbolRef::getAlignment() const {
358 return getObject()->getSymbolAlignment(getRawDataRefImpl());
359}
360
361inline uint64_t SymbolRef::getCommonSize() const {
362 return getObject()->getCommonSymbolSize(getRawDataRefImpl());
363}
364
365inline Expected<section_iterator> SymbolRef::getSection() const {
366 return getObject()->getSymbolSection(getRawDataRefImpl());
367}
368
369inline Expected<SymbolRef::Type> SymbolRef::getType() const {
370 return getObject()->getSymbolType(getRawDataRefImpl());
371}
372
373inline const ObjectFile *SymbolRef::getObject() const {
374 const SymbolicFile *O = BasicSymbolRef::getObject();
375 return cast<ObjectFile>(O);
376}
377
378/// SectionRef
379inline SectionRef::SectionRef(DataRefImpl SectionP,
380 const ObjectFile *Owner)
381 : SectionPimpl(SectionP)
382 , OwningObject(Owner) {}
383
384inline bool SectionRef::operator==(const SectionRef &Other) const {
385 return SectionPimpl == Other.SectionPimpl;
386}
387
388inline bool SectionRef::operator!=(const SectionRef &Other) const {
389 return SectionPimpl != Other.SectionPimpl;
390}
391
392inline bool SectionRef::operator<(const SectionRef &Other) const {
393 return SectionPimpl < Other.SectionPimpl;
394}
395
396inline void SectionRef::moveNext() {
397 return OwningObject->moveSectionNext(SectionPimpl);
398}
399
400inline std::error_code SectionRef::getName(StringRef &Result) const {
401 return OwningObject->getSectionName(SectionPimpl, Result);
402}
403
404inline uint64_t SectionRef::getAddress() const {
405 return OwningObject->getSectionAddress(SectionPimpl);
406}
407
408inline uint64_t SectionRef::getIndex() const {
409 return OwningObject->getSectionIndex(SectionPimpl);
410}
411
412inline uint64_t SectionRef::getSize() const {
413 return OwningObject->getSectionSize(SectionPimpl);
414}
415
416inline std::error_code SectionRef::getContents(StringRef &Result) const {
417 return OwningObject->getSectionContents(SectionPimpl, Result);
15
Called C++ object pointer is null
418}
419
420inline uint64_t SectionRef::getAlignment() const {
421 return OwningObject->getSectionAlignment(SectionPimpl);
422}
423
424inline bool SectionRef::isCompressed() const {
425 return OwningObject->isSectionCompressed(SectionPimpl);
426}
427
428inline bool SectionRef::isText() const {
429 return OwningObject->isSectionText(SectionPimpl);
430}
431
432inline bool SectionRef::isData() const {
433 return OwningObject->isSectionData(SectionPimpl);
434}
435
436inline bool SectionRef::isBSS() const {
437 return OwningObject->isSectionBSS(SectionPimpl);
438}
439
440inline bool SectionRef::isVirtual() const {
441 return OwningObject->isSectionVirtual(SectionPimpl);
442}
443
444inline bool SectionRef::isBitcode() const {
445 return OwningObject->isSectionBitcode(SectionPimpl);
446}
447
448inline bool SectionRef::isStripped() const {
449 return OwningObject->isSectionStripped(SectionPimpl);
450}
451
452inline relocation_iterator SectionRef::relocation_begin() const {
453 return OwningObject->section_rel_begin(SectionPimpl);
454}
455
456inline relocation_iterator SectionRef::relocation_end() const {
457 return OwningObject->section_rel_end(SectionPimpl);
458}
459
460inline section_iterator SectionRef::getRelocatedSection() const {
461 return OwningObject->getRelocatedSection(SectionPimpl);
462}
463
464inline DataRefImpl SectionRef::getRawDataRefImpl() const {
465 return SectionPimpl;
466}
467
468inline const ObjectFile *SectionRef::getObject() const {
469 return OwningObject;
470}
471
472/// RelocationRef
473inline RelocationRef::RelocationRef(DataRefImpl RelocationP,
474 const ObjectFile *Owner)
475 : RelocationPimpl(RelocationP)
476 , OwningObject(Owner) {}
477
478inline bool RelocationRef::operator==(const RelocationRef &Other) const {
479 return RelocationPimpl == Other.RelocationPimpl;
480}
481
482inline void RelocationRef::moveNext() {
483 return OwningObject->moveRelocationNext(RelocationPimpl);
484}
485
486inline uint64_t RelocationRef::getOffset() const {
487 return OwningObject->getRelocationOffset(RelocationPimpl);
488}
489
490inline symbol_iterator RelocationRef::getSymbol() const {
491 return OwningObject->getRelocationSymbol(RelocationPimpl);
492}
493
494inline uint64_t RelocationRef::getType() const {
495 return OwningObject->getRelocationType(RelocationPimpl);
496}
497
498inline void RelocationRef::getTypeName(SmallVectorImpl<char> &Result) const {
499 return OwningObject->getRelocationTypeName(RelocationPimpl, Result);
500}
501
502inline DataRefImpl RelocationRef::getRawDataRefImpl() const {
503 return RelocationPimpl;
504}
505
506inline const ObjectFile *RelocationRef::getObject() const {
507 return OwningObject;
508}
509
510} // end namespace object
511
512} // end namespace llvm
513
514#endif // LLVM_OBJECT_OBJECTFILE_H