[PATCH] D12972: [Object/ELF] Ensure preconditions are satisfied.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 10:15:15 PDT 2015


davide created this revision.
davide added a reviewer: rafael.
davide added a subscriber: llvm-commits.
davide set the repository for this revision to rL LLVM.

Also, clarify a comment while at it.

Repository:
  rL LLVM

http://reviews.llvm.org/D12972

Files:
  include/llvm/Object/ELF.h

Index: include/llvm/Object/ELF.h
===================================================================
--- include/llvm/Object/ELF.h
+++ include/llvm/Object/ELF.h
@@ -86,7 +86,7 @@
   void getRelocationTypeName(uint32_t Type,
                              SmallVectorImpl<char> &Result) const;
 
-  /// \brief Get the symbol table section and symbol for a given relocation.
+  /// \brief Get the symbol for a given relocation.
   template <class RelT>
   const Elf_Sym *getRelocationSymbol(const RelT *Rel,
                                      const Elf_Shdr *SymTab) const;
@@ -293,6 +293,8 @@
 const typename ELFFile<ELFT>::Elf_Sym *
 ELFFile<ELFT>::getRelocationSymbol(const RelT *Rel,
                                    const Elf_Shdr *SymTab) const {
+  assert(Rel && "Invalid relocation");
+  assert(SymTab && "Invalid symbol table");
   uint32_t Index = Rel->getSymbol(isMips64EL());
   if (Index == 0)
     return nullptr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12972.35101.patch
Type: text/x-patch
Size: 931 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150918/c0d2f9e5/attachment.bin>


More information about the llvm-commits mailing list