projects
/
folly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a6198d2
)
Enable Elf::at<T> only for POD data types
author
Peter Griess
<pgriess@fb.com>
Fri, 22 Mar 2013 15:12:30 +0000
(08:12 -0700)
committer
Owen Yamauchi
<oyamauchi@fb.com>
Wed, 27 Mar 2013 21:40:35 +0000
(14:40 -0700)
Summary:
- Make sure that the utility function Elf::at<T> only works for POD
datatypes, as it uses reinterpret_cast<T>.
Test Plan: - Unit tests
Reviewed By: simpkins@fb.com
FB internal diff:
D748314
folly/experimental/symbolizer/Elf.h
patch
|
blob
|
history
diff --git
a/folly/experimental/symbolizer/Elf.h
b/folly/experimental/symbolizer/Elf.h
index 88eae5e39200c400d6749a598385fdeb76bfd09e..91f587c23563250520930df0bffa431ab85bbca1 100644
(file)
--- a/
folly/experimental/symbolizer/Elf.h
+++ b/
folly/experimental/symbolizer/Elf.h
@@
-123,7
+123,8
@@
class ElfFile {
void validateStringTable(const ElfW(Shdr)& stringTable) const;
template <class T>
- const T& at(off_t offset) const {
+ const typename std::enable_if<std::is_pod<T>::value, T>::type&
+ at(off_t offset) const {
return *reinterpret_cast<T*>(file_ + offset);
}