diff options
author | Sean Silva <silvas@purdue.edu> | 2012-10-11 23:31:18 +0000 |
---|---|---|
committer | Sean Silva <silvas@purdue.edu> | 2012-10-11 23:31:18 +0000 |
commit | d680b986651227b10f1e307861bc23cc89064161 (patch) | |
tree | 87c9e8d8b208f1b79ae3978d29d30de706f3fbb4 /lib/Rewrite/Core/DeltaTree.cpp | |
parent | abeadfb11fde148f15c2fd67015e8163609d5b68 (diff) |
Add missing classof().
Somewhat troublingly, without this implemented, the check inside
isa_impl<> would silently use the parent's `classof()` when determining
whether it was okay to downcast from the parent to the child!
Bug analysis:
A build failure after removing the parent's `classof()` initially
alerted me to the bug, after which a little bit of thinking and reading
of the code identified the root cause.
The compiler could be made to prevent this bug from happening if there
were a way to ensure that in the code
template <typename To, typename From, typename Enabler = void>
struct isa_impl {
static inline bool doit(const From &Val) {
return To::classof(&Val);
}
};
that `To::classof` is actually inside the class `To`, and not in a base
class. I am not aware of a way to check this in C++. If there is a means
to perform that check, please bring it up on the list and this will be
fixed.
There is a high likelihood that there are other instances of this same
bug in the codebase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165769 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite/Core/DeltaTree.cpp')
0 files changed, 0 insertions, 0 deletions