diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-06-28 17:57:36 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-06-28 17:57:36 +0000 |
commit | b27564af76871fc4c8f8ba372ea81a37ae67553b (patch) | |
tree | 13b3be9fe64ed1b79fa5eddc9db88169d23af265 | |
parent | 6317bfb26acde133c5d7f7074a0efcb972972280 (diff) | |
download | bcm5719-llvm-b27564af76871fc4c8f8ba372ea81a37ae67553b.tar.gz bcm5719-llvm-b27564af76871fc4c8f8ba372ea81a37ae67553b.zip |
Compare the canonical types and document why we give up on the covariant case.
llvm-svn: 159360
-rw-r--r-- | clang/lib/CodeGen/CGExprCXX.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index 4b0bff0ad0d..cb15fe27297 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -202,8 +202,14 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE, // we don't have support for that yet, so do a virtual call. DevirtualizedMethod = NULL; } - if (DevirtualizedMethod && DevirtualizedMethod->getResultType() != - MD->getResultType()) + // If the return types are not the same, this might be a case where more + // code needs to run to compensate for it. For example, the derived + // method might return a type that inherits form from the return + // type of MD and has a prefix. + // For now we just avoid devirtualizing these covariant cases. + if (DevirtualizedMethod && + DevirtualizedMethod->getResultType().getCanonicalType() != + MD->getResultType().getCanonicalType()) DevirtualizedMethod = NULL; } |