llvm.org GIT mirror llvm / ec6cc05
Add a herper function. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242100 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 4 years ago
2 changed file(s) with 8 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
206206
207207 bool hasSymbolTable() const;
208208 child_iterator getSymbolTableChild() const { return SymbolTable; }
209 StringRef getSymbolTable() const { return SymbolTable->getBuffer(); }
209210 uint32_t getNumberOfSymbols() const;
210211
211212 private:
352352 }
353353
354354 StringRef Archive::Symbol::getName() const {
355 return Parent->SymbolTable->getBuffer().begin() + StringIndex;
355 return Parent->getSymbolTable().begin() + StringIndex;
356356 }
357357
358358 ErrorOr Archive::Symbol::getMember() const {
359 const char *Buf = Parent->SymbolTable->getBuffer().begin();
359 const char *Buf = Parent->getSymbolTable().begin();
360360 const char *Offsets = Buf;
361361 if (Parent->kind() == K_MIPS64)
362362 Offsets += sizeof(uint64_t);
420420 // and the second being the offset into the archive of the member that
421421 // define the symbol. After that the next uint32_t is the byte count of
422422 // the string table followed by the string table.
423 const char *Buf = Parent->SymbolTable->getBuffer().begin();
423 const char *Buf = Parent->getSymbolTable().begin();
424424 uint32_t RanlibCount = 0;
425425 RanlibCount = read32le(Buf) / 8;
426426 // If t.SymbolIndex + 1 will be past the count of symbols (the RanlibCount)
437437 }
438438 } else {
439439 // Go to one past next null.
440 t.StringIndex =
441 Parent->SymbolTable->getBuffer().find('\0', t.StringIndex) + 1;
440 t.StringIndex = Parent->getSymbolTable().find('\0', t.StringIndex) + 1;
442441 }
443442 ++t.SymbolIndex;
444443 return t;
448447 if (!hasSymbolTable())
449448 return symbol_iterator(Symbol(this, 0, 0));
450449
451 const char *buf = SymbolTable->getBuffer().begin();
450 const char *buf = getSymbolTable().begin();
452451 if (kind() == K_GNU) {
453452 uint32_t symbol_count = 0;
454453 symbol_count = read32be(buf);
480479 symbol_count = read32le(buf);
481480 buf += 4 + (symbol_count * 2); // Skip indices.
482481 }
483 uint32_t string_start_offset = buf - SymbolTable->getBuffer().begin();
482 uint32_t string_start_offset = buf - getSymbolTable().begin();
484483 return symbol_iterator(Symbol(this, 0, string_start_offset));
485484 }
486485
491490 }
492491
493492 uint32_t Archive::getNumberOfSymbols() const {
494 const char *buf = SymbolTable->getBuffer().begin();
493 const char *buf = getSymbolTable().begin();
495494 if (kind() == K_GNU)
496495 return read32be(buf);
497496 if (kind() == K_MIPS64)