[cfe-commits] r159360 - /cfe/trunk/lib/CodeGen/CGExprCXX.cpp
Rafael Espindola
rafael.espindola at gmail.com
Thu Jun 28 10:57:37 PDT 2012
Author: rafael
Date: Thu Jun 28 12:57:36 2012
New Revision: 159360
URL: http://llvm.org/viewvc/llvm-project?rev=159360&view=rev
Log:
Compare the canonical types and document why we give up on the covariant case.
Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=159360&r1=159359&r2=159360&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Thu Jun 28 12:57:36 2012
@@ -202,8 +202,14 @@
// 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;
}
More information about the cfe-commits
mailing list