summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-01-31 20:57:12 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-01-31 20:57:12 +0000
commitd8324e6983d06c3d56debcbfdc9ead0e0d4a817d (patch)
treef50eaaa3e9f03b323aab113dc92b2bc77756d2f3 /include
parentc2c98e78842b364df35a34639f217339e0bc5118 (diff)
downloadllvm-d8324e6983d06c3d56debcbfdc9ead0e0d4a817d.tar.gz
llvm-d8324e6983d06c3d56debcbfdc9ead0e0d4a817d.tar.bz2
llvm-d8324e6983d06c3d56debcbfdc9ead0e0d4a817d.tar.xz
Simplify getSymbolFlags.
None of the object formats require extra parsing to compute these flags, so the method cannot fail. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200574 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Object/COFF.h3
-rw-r--r--include/llvm/Object/ELFObjectFile.h9
-rw-r--r--include/llvm/Object/MachO.h3
-rw-r--r--include/llvm/Object/ObjectFile.h9
4 files changed, 10 insertions, 14 deletions
diff --git a/include/llvm/Object/COFF.h b/include/llvm/Object/COFF.h
index 248545d196..5d99508f57 100644
--- a/include/llvm/Object/COFF.h
+++ b/include/llvm/Object/COFF.h
@@ -279,8 +279,7 @@ protected:
error_code getSymbolFileOffset(DataRefImpl Symb, uint64_t &Res) const
LLVM_OVERRIDE;
error_code getSymbolSize(DataRefImpl Symb, uint64_t &Res) const LLVM_OVERRIDE;
- error_code getSymbolFlags(DataRefImpl Symb, uint32_t &Res) const
- LLVM_OVERRIDE;
+ uint32_t getSymbolFlags(DataRefImpl Symb) const LLVM_OVERRIDE;
error_code getSymbolType(DataRefImpl Symb, SymbolRef::Type &Res) const
LLVM_OVERRIDE;
error_code getSymbolSection(DataRefImpl Symb, section_iterator &Res) const
diff --git a/include/llvm/Object/ELFObjectFile.h b/include/llvm/Object/ELFObjectFile.h
index f6b874397a..5433a7a1b3 100644
--- a/include/llvm/Object/ELFObjectFile.h
+++ b/include/llvm/Object/ELFObjectFile.h
@@ -65,7 +65,7 @@ protected:
error_code getSymbolAlignment(DataRefImpl Symb, uint32_t &Res) const
LLVM_OVERRIDE;
error_code getSymbolSize(DataRefImpl Symb, uint64_t &Res) const LLVM_OVERRIDE;
- error_code getSymbolFlags(DataRefImpl Symb, uint32_t &Res) const;
+ uint32_t getSymbolFlags(DataRefImpl Symb) const LLVM_OVERRIDE;
error_code getSymbolType(DataRefImpl Symb, SymbolRef::Type &Res) const
LLVM_OVERRIDE;
error_code getSymbolSection(DataRefImpl Symb, section_iterator &Res) const
@@ -378,11 +378,10 @@ error_code ELFObjectFile<ELFT>::getSymbolType(DataRefImpl Symb,
}
template <class ELFT>
-error_code ELFObjectFile<ELFT>::getSymbolFlags(DataRefImpl Symb,
- uint32_t &Result) const {
+uint32_t ELFObjectFile<ELFT>::getSymbolFlags(DataRefImpl Symb) const {
const Elf_Sym *ESym = getSymbol(Symb);
- Result = SymbolRef::SF_None;
+ uint32_t Result = SymbolRef::SF_None;
if (ESym->getBinding() != ELF::STB_LOCAL)
Result |= SymbolRef::SF_Global;
@@ -407,7 +406,7 @@ error_code ELFObjectFile<ELFT>::getSymbolFlags(DataRefImpl Symb,
if (ESym->getType() == ELF::STT_TLS)
Result |= SymbolRef::SF_ThreadLocal;
- return object_error::success;
+ return Result;
}
template <class ELFT>
diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h
index 1f36938ea6..44217fc54f 100644
--- a/include/llvm/Object/MachO.h
+++ b/include/llvm/Object/MachO.h
@@ -71,8 +71,7 @@ public:
error_code getSymbolSize(DataRefImpl Symb, uint64_t &Res) const LLVM_OVERRIDE;
error_code getSymbolType(DataRefImpl Symb, SymbolRef::Type &Res) const
LLVM_OVERRIDE;
- error_code getSymbolFlags(DataRefImpl Symb, uint32_t &Res) const
- LLVM_OVERRIDE;
+ uint32_t getSymbolFlags(DataRefImpl Symb) const LLVM_OVERRIDE;
error_code getSymbolSection(DataRefImpl Symb, section_iterator &Res) const
LLVM_OVERRIDE;
error_code getSymbolValue(DataRefImpl Symb, uint64_t &Val) const
diff --git a/include/llvm/Object/ObjectFile.h b/include/llvm/Object/ObjectFile.h
index 69300c6628..131c822e6a 100644
--- a/include/llvm/Object/ObjectFile.h
+++ b/include/llvm/Object/ObjectFile.h
@@ -219,7 +219,7 @@ public:
error_code getType(SymbolRef::Type &Result) const;
/// Get symbol flags (bitwise OR of SymbolRef::Flags)
- error_code getFlags(uint32_t &Result) const;
+ uint32_t getFlags() const;
/// @brief Get section this symbol is defined in reference to. Result is
/// end_sections() if it is undefined or is an absolute symbol.
@@ -289,8 +289,7 @@ protected:
virtual error_code getSymbolSize(DataRefImpl Symb, uint64_t &Res) const = 0;
virtual error_code getSymbolType(DataRefImpl Symb,
SymbolRef::Type &Res) const = 0;
- virtual error_code getSymbolFlags(DataRefImpl Symb,
- uint32_t &Res) const = 0;
+ virtual uint32_t getSymbolFlags(DataRefImpl Symb) const = 0;
virtual error_code getSymbolSection(DataRefImpl Symb,
section_iterator &Res) const = 0;
virtual error_code getSymbolValue(DataRefImpl Symb, uint64_t &Val) const = 0;
@@ -428,8 +427,8 @@ inline error_code SymbolRef::getSize(uint64_t &Result) const {
return OwningObject->getSymbolSize(SymbolPimpl, Result);
}
-inline error_code SymbolRef::getFlags(uint32_t &Result) const {
- return OwningObject->getSymbolFlags(SymbolPimpl, Result);
+inline uint32_t SymbolRef::getFlags() const {
+ return OwningObject->getSymbolFlags(SymbolPimpl);
}
inline error_code SymbolRef::getSection(section_iterator &Result) const {