--- a/src/google/protobuf/compiler/cpp/message.cc
+++ b/src/google/protobuf/compiler/cpp/message.cc
@@ -1300,7 +1300,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {
"friend void swap($classname$& a, $classname$& b) {\n"
" a.Swap(&b);\n"
"}\n"
- "inline void Swap($classname$* other) {\n"
+ "PROTOBUF_NOINLINE void Swap($classname$* other) {\n"
" if (other == this) return;\n"
" if (GetArena() == other->GetArena()) {\n"
" InternalSwap(other);\n"