|
@@ -45,22 +45,7 @@ namespace cpp {
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
-// When we are generating code for implicit weak fields, we need to insert some
|
|
|
-// additional casts. These functions return the casted expression if
|
|
|
-// implicit_weak_field is true but otherwise return the original expression.
|
|
|
-// Ordinarily a static_cast is enough to cast google::protobuf::MessageLite* to a class
|
|
|
-// deriving from it, but we need a reinterpret_cast in cases where the generated
|
|
|
-// message is forward-declared but its full definition is not visible.
|
|
|
-string StaticCast(const std::string& type, const std::string& expression,
|
|
|
- bool implicit_weak_field) {
|
|
|
- if (implicit_weak_field) {
|
|
|
- return "static_cast< " + type + " >(" + expression + ")";
|
|
|
- } else {
|
|
|
- return expression;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-string ReinterpretCast(const std::string& type, const std::string& expression,
|
|
|
+string ReinterpretCast(const string& type, const string& expression,
|
|
|
bool implicit_weak_field) {
|
|
|
if (implicit_weak_field) {
|
|
|
return "reinterpret_cast< " + type + " >(" + expression + ")";
|