Merge pull request #5368 from haberman/objc

Some changes to the ObjC code generator to support importing into Google.
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_enum.h b/src/google/protobuf/compiler/objectivec/objectivec_enum.h
index f52e9e6..d9dfc8a 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_enum.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_enum.h
@@ -35,15 +35,10 @@
 #include <set>
 #include <vector>
 #include <google/protobuf/descriptor.h>
+#include <google/protobuf/io/printer.h>
 
 namespace google {
 namespace protobuf {
-namespace io {
-class Printer;  // printer.h
-}
-}
-
-namespace protobuf {
 namespace compiler {
 namespace objectivec {
 
@@ -52,6 +47,9 @@
   explicit EnumGenerator(const EnumDescriptor* descriptor);
   ~EnumGenerator();
 
+  EnumGenerator(const EnumGenerator&) = delete;
+  EnumGenerator& operator=(const EnumGenerator&) = delete;
+
   void GenerateHeader(io::Printer* printer);
   void GenerateSource(io::Printer* printer);
 
@@ -62,12 +60,11 @@
   std::vector<const EnumValueDescriptor*> base_values_;
   std::vector<const EnumValueDescriptor*> all_values_;
   const string name_;
-
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator);
 };
 
 }  // namespace objectivec
 }  // namespace compiler
 }  // namespace protobuf
 }  // namespace google
+
 #endif  // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ENUM_H__
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
index 8899a13..9890d0a 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_enum_field.cc
@@ -32,11 +32,9 @@
 #include <string>
 
 #include <google/protobuf/compiler/objectivec/objectivec_enum_field.h>
-#include <google/protobuf/stubs/common.h>
 #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
 #include <google/protobuf/io/printer.h>
 #include <google/protobuf/wire_format.h>
-#include <google/protobuf/stubs/strutil.h>
 
 namespace google {
 namespace protobuf {
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h b/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
index ae56c06..5a69c97 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
@@ -44,6 +44,9 @@
   friend FieldGenerator* FieldGenerator::Make(const FieldDescriptor* field,
                                               const Options& options);
 
+  EnumFieldGenerator(const EnumFieldGenerator&) = delete;
+  EnumFieldGenerator& operator=(const EnumFieldGenerator&) = delete;
+
  public:
   virtual void GenerateCFunctionDeclarations(io::Printer* printer) const;
   virtual void GenerateCFunctionImplementations(io::Printer* printer) const;
@@ -52,9 +55,6 @@
  protected:
   EnumFieldGenerator(const FieldDescriptor* descriptor, const Options& options);
   virtual ~EnumFieldGenerator();
-
- private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator);
 };
 
 class RepeatedEnumFieldGenerator : public RepeatedFieldGenerator {
@@ -68,9 +68,6 @@
   RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor,
                              const Options& options);
   virtual ~RepeatedEnumFieldGenerator();
-
- private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator);
 };
 
 }  // namespace objectivec
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_extension.h b/src/google/protobuf/compiler/objectivec/objectivec_extension.h
index e361e63..d49a4f1 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_extension.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_extension.h
@@ -31,17 +31,11 @@
 #ifndef GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_EXTENSION_H__
 #define GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_EXTENSION_H__
 
-#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/io/printer.h>
 
 namespace google {
 namespace protobuf {
-class FieldDescriptor;  // descriptor.h
-namespace io {
-class Printer;  // printer.h
-}
-}
-
-namespace protobuf {
 namespace compiler {
 namespace objectivec {
 
@@ -51,6 +45,9 @@
                      const FieldDescriptor* descriptor);
   ~ExtensionGenerator();
 
+  ExtensionGenerator(const ExtensionGenerator&) = delete;
+  ExtensionGenerator& operator=(const ExtensionGenerator&) = delete;
+
   void GenerateMembersHeader(io::Printer* printer);
   void GenerateStaticVariablesInitialization(io::Printer* printer);
   void GenerateRegistrationSource(io::Printer* printer);
@@ -59,11 +56,11 @@
   string method_name_;
   string root_class_and_method_name_;
   const FieldDescriptor* descriptor_;
-
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator);
 };
+
 }  // namespace objectivec
 }  // namespace compiler
 }  // namespace protobuf
 }  // namespace google
+
 #endif  // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_field.cc
index f74599b..3361bf9 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_field.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_field.cc
@@ -38,7 +38,6 @@
 #include <google/protobuf/compiler/objectivec/objectivec_primitive_field.h>
 #include <google/protobuf/io/printer.h>
 #include <google/protobuf/wire_format.h>
-#include <google/protobuf/stubs/common.h>
 #include <google/protobuf/stubs/strutil.h>
 
 namespace google {
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_field.h b/src/google/protobuf/compiler/objectivec/objectivec_field.h
index 216034d..24465d0 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_field.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_field.h
@@ -34,16 +34,11 @@
 #include <map>
 #include <string>
 #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
-#include <google/protobuf/stubs/common.h>
 #include <google/protobuf/descriptor.h>
+#include <google/protobuf/io/printer.h>
 
 namespace google {
 namespace protobuf {
-
-namespace io {
-class Printer;  // printer.h
-}  // namespace io
-
 namespace compiler {
 namespace objectivec {
 
@@ -54,6 +49,9 @@
 
   virtual ~FieldGenerator();
 
+  FieldGenerator(const FieldGenerator&) = delete;
+  FieldGenerator& operator=(const FieldGenerator&) = delete;
+
   // Exposed for subclasses to fill in.
   virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const = 0;
   virtual void GeneratePropertyDeclaration(io::Printer* printer) const = 0;
@@ -101,15 +99,15 @@
 
   const FieldDescriptor* descriptor_;
   std::map<string, string> variables_;
-
- private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGenerator);
 };
 
 class SingleFieldGenerator : public FieldGenerator {
  public:
   virtual ~SingleFieldGenerator();
 
+  SingleFieldGenerator(const SingleFieldGenerator&) = delete;
+  SingleFieldGenerator& operator=(const SingleFieldGenerator&) = delete;
+
   virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const;
   virtual void GeneratePropertyDeclaration(io::Printer* printer) const;
 
@@ -121,9 +119,6 @@
   SingleFieldGenerator(const FieldDescriptor* descriptor,
                        const Options& options);
   virtual bool WantsHasProperty(void) const;
-
- private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SingleFieldGenerator);
 };
 
 // Subclass with common support for when the field ends up as an ObjC Object.
@@ -131,21 +126,24 @@
  public:
   virtual ~ObjCObjFieldGenerator();
 
+  ObjCObjFieldGenerator(const ObjCObjFieldGenerator&) = delete;
+  ObjCObjFieldGenerator& operator=(const ObjCObjFieldGenerator&) = delete;
+
   virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const;
   virtual void GeneratePropertyDeclaration(io::Printer* printer) const;
 
  protected:
   ObjCObjFieldGenerator(const FieldDescriptor* descriptor,
                         const Options& options);
-
- private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ObjCObjFieldGenerator);
 };
 
 class RepeatedFieldGenerator : public ObjCObjFieldGenerator {
  public:
   virtual ~RepeatedFieldGenerator();
 
+  RepeatedFieldGenerator(const RepeatedFieldGenerator&) = delete;
+  RepeatedFieldGenerator& operator=(const RepeatedFieldGenerator&) = delete;
+
   virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const;
   virtual void GeneratePropertyDeclaration(io::Printer* printer) const;
 
@@ -158,9 +156,6 @@
                          const Options& options);
   virtual void FinishInitialization(void);
   virtual bool WantsHasProperty(void) const;
-
- private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedFieldGenerator);
 };
 
 // Convenience class which constructs FieldGenerators for a Descriptor.
@@ -169,6 +164,9 @@
   FieldGeneratorMap(const Descriptor* descriptor, const Options& options);
   ~FieldGeneratorMap();
 
+  FieldGeneratorMap(const FieldGeneratorMap&) = delete;
+  FieldGeneratorMap& operator=(const FieldGeneratorMap&) = delete;
+
   const FieldGenerator& get(const FieldDescriptor* field) const;
   const FieldGenerator& get_extension(int index) const;
 
@@ -184,11 +182,11 @@
   const Descriptor* descriptor_;
   std::vector<std::unique_ptr<FieldGenerator>> field_generators_;
   std::vector<std::unique_ptr<FieldGenerator>> extension_generators_;
-
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
 };
+
 }  // namespace objectivec
 }  // namespace compiler
 }  // namespace protobuf
 }  // namespace google
+
 #endif  // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_FIELD_H__
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.h b/src/google/protobuf/compiler/objectivec/objectivec_file.h
index 1754fc0..ed7fad8 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_file.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_file.h
@@ -35,17 +35,11 @@
 #include <set>
 #include <vector>
 #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
-#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/io/printer.h>
 
 namespace google {
 namespace protobuf {
-class FileDescriptor;  // descriptor.h
-namespace io {
-class Printer;  // printer.h
-}
-}
-
-namespace protobuf {
 namespace compiler {
 namespace objectivec {
 
@@ -58,6 +52,9 @@
   FileGenerator(const FileDescriptor* file, const Options& options);
   ~FileGenerator();
 
+  FileGenerator(const FileGenerator&) = delete;
+  FileGenerator& operator=(const FileGenerator&) = delete;
+
   void GenerateSource(io::Printer* printer);
   void GenerateHeader(io::Printer* printer);
 
@@ -76,8 +73,6 @@
 
   void PrintFileRuntimePreamble(
       io::Printer* printer, const std::set<string>& headers_to_import) const;
-
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
 };
 
 }  // namespace objectivec
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_generator.h b/src/google/protobuf/compiler/objectivec/objectivec_generator.h
index ac20cfd..d10efc2 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_generator.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_generator.h
@@ -35,6 +35,7 @@
 
 #include <string>
 #include <google/protobuf/compiler/code_generator.h>
+#include <google/protobuf/descriptor.h>
 
 #include <google/protobuf/port_def.inc>
 
@@ -52,6 +53,9 @@
   ObjectiveCGenerator();
   ~ObjectiveCGenerator();
 
+  ObjectiveCGenerator(const ObjectiveCGenerator&) = delete;
+  ObjectiveCGenerator& operator=(const ObjectiveCGenerator&) = delete;
+
   // implements CodeGenerator ----------------------------------------
   bool HasGenerateAll() const;
   bool Generate(const FileDescriptor* file,
@@ -62,9 +66,6 @@
                    const string& parameter,
                    GeneratorContext* context,
                    string* error) const;
-
- private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ObjectiveCGenerator);
 };
 
 }  // namespace objectivec
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
index a67840c..1432798 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
@@ -41,14 +41,12 @@
 #include <unordered_set>
 #include <vector>
 
-#include <google/protobuf/stubs/hash.h>
 #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
 #include <google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h>
 #include <google/protobuf/descriptor.pb.h>
 #include <google/protobuf/io/coded_stream.h>
 #include <google/protobuf/io/printer.h>
 #include <google/protobuf/io/zero_copy_stream_impl.h>
-#include <google/protobuf/stubs/common.h>
 #include <google/protobuf/stubs/io_win32.h>
 #include <google/protobuf/stubs/strutil.h>
 
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
index 3ec465f..218a31d 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
@@ -230,6 +230,9 @@
   TextFormatDecodeData();
   ~TextFormatDecodeData();
 
+  TextFormatDecodeData(const TextFormatDecodeData&) = delete;
+  TextFormatDecodeData& operator=(const TextFormatDecodeData&) = delete;
+
   void AddString(int32 key, const string& input_for_decode,
                  const string& desired_output);
   size_t num_entries() const { return entries_.size(); }
@@ -239,8 +242,6 @@
                                     const string& desired_output);
 
  private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(TextFormatDecodeData);
-
   typedef std::pair<int32, string> DataEntry;
   std::vector<DataEntry> entries_;
 };
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
index bcaf570..6abad8b 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
@@ -32,11 +32,8 @@
 #include <string>
 
 #include <google/protobuf/compiler/objectivec/objectivec_map_field.h>
-#include <google/protobuf/stubs/common.h>
 #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
 #include <google/protobuf/io/printer.h>
-#include <google/protobuf/stubs/strutil.h>
-#include <google/protobuf/stubs/substitute.h>
 
 namespace google {
 namespace protobuf {
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_map_field.h b/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
index dc7beac..c308501 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
@@ -47,6 +47,9 @@
  public:
   virtual void FinishInitialization(void);
 
+  MapFieldGenerator(const MapFieldGenerator&) = delete;
+  MapFieldGenerator& operator=(const MapFieldGenerator&) = delete;
+
  protected:
   MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options);
   virtual ~MapFieldGenerator();
@@ -55,8 +58,6 @@
 
  private:
   std::unique_ptr<FieldGenerator> value_field_generator_;
-
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator);
 };
 
 }  // namespace objectivec
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_message.cc b/src/google/protobuf/compiler/objectivec/objectivec_message.cc
index 8388885..71ca00d 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_message.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_message.cc
@@ -32,7 +32,6 @@
 #include <iostream>
 #include <sstream>
 
-#include <google/protobuf/stubs/hash.h>
 #include <google/protobuf/compiler/objectivec/objectivec_message.h>
 #include <google/protobuf/compiler/objectivec/objectivec_enum.h>
 #include <google/protobuf/compiler/objectivec/objectivec_extension.h>
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_message.h b/src/google/protobuf/compiler/objectivec/objectivec_message.h
index 2de03f1..1d41628 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_message.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_message.h
@@ -37,15 +37,11 @@
 #include <google/protobuf/compiler/objectivec/objectivec_field.h>
 #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
 #include <google/protobuf/compiler/objectivec/objectivec_oneof.h>
-#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/io/printer.h>
 
 namespace google {
 namespace protobuf {
-
-namespace io {
-class Printer;  // printer.h
-}  // namespace io
-
 namespace compiler {
 namespace objectivec {
 
@@ -59,6 +55,9 @@
                    const Options& options);
   ~MessageGenerator();
 
+  MessageGenerator(const MessageGenerator&) = delete;
+  MessageGenerator& operator=(const MessageGenerator&) = delete;
+
   void GenerateStaticVariablesInitialization(io::Printer* printer);
   void GenerateEnumHeader(io::Printer* printer);
   void GenerateMessageHeader(io::Printer* printer);
@@ -90,11 +89,11 @@
   std::vector<EnumGenerator*> enum_generators_;
   std::vector<MessageGenerator*> nested_message_generators_;
   std::vector<OneofGenerator*> oneof_generators_;
-
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator);
 };
+
 }  // namespace objectivec
 }  // namespace compiler
 }  // namespace protobuf
 }  // namespace google
+
 #endif  // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_MESSAGE_H__
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
index 699d25b..8a0299e 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_message_field.cc
@@ -35,7 +35,6 @@
 #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
 #include <google/protobuf/io/printer.h>
 #include <google/protobuf/wire_format.h>
-#include <google/protobuf/stubs/strutil.h>
 
 namespace google {
 namespace protobuf {
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_message_field.h b/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
index 50f4b6d..98d4579 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
@@ -47,14 +47,15 @@
  protected:
   MessageFieldGenerator(const FieldDescriptor* descriptor,
                         const Options& options);
+
+  MessageFieldGenerator(const MessageFieldGenerator&) = delete;
+  MessageFieldGenerator& operator=(const MessageFieldGenerator&) = delete;
+
   virtual ~MessageFieldGenerator();
   virtual bool WantsHasProperty(void) const;
 
  public:
   virtual void DetermineForwardDeclarations(std::set<string>* fwd_decls) const;
-
- private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
 };
 
 class RepeatedMessageFieldGenerator : public RepeatedFieldGenerator {
@@ -66,11 +67,11 @@
                                 const Options& options);
   virtual ~RepeatedMessageFieldGenerator();
 
+  RepeatedMessageFieldGenerator(const RepeatedMessageFieldGenerator&) = delete;
+  RepeatedMessageFieldGenerator operator=(const RepeatedMessageFieldGenerator&) = delete;
+
  public:
   virtual void DetermineForwardDeclarations(std::set<string>* fwd_decls) const;
-
- private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator);
 };
 
 }  // namespace objectivec
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_oneof.h b/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
index ff353a6..852ef02 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
@@ -35,15 +35,10 @@
 #include <set>
 #include <vector>
 #include <google/protobuf/descriptor.h>
+#include <google/protobuf/io/printer.h>
 
 namespace google {
 namespace protobuf {
-namespace io {
-class Printer;  // printer.h
-}
-}
-
-namespace protobuf {
 namespace compiler {
 namespace objectivec {
 
@@ -52,6 +47,9 @@
   explicit OneofGenerator(const OneofDescriptor* descriptor);
   ~OneofGenerator();
 
+  OneofGenerator(const OneofGenerator&) = delete;
+  OneofGenerator& operator=(const OneofGenerator&) = delete;
+
   void SetOneofIndexBase(int index_base);
 
   void GenerateCaseEnum(io::Printer* printer);
@@ -68,12 +66,11 @@
  private:
   const OneofDescriptor* descriptor_;
   std::map<string, string> variables_;
-
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(OneofGenerator);
 };
 
 }  // namespace objectivec
 }  // namespace compiler
 }  // namespace protobuf
 }  // namespace google
+
 #endif  // GOOGLE_PROTOBUF_COMPILER_OBJECTIVEC_ONEOF_H__
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
index aa8ac32..fe278bc 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.cc
@@ -31,14 +31,12 @@
 #include <map>
 #include <string>
 
-#include <google/protobuf/compiler/objectivec/objectivec_primitive_field.h>
-#include <google/protobuf/stubs/common.h>
 #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
+#include <google/protobuf/compiler/objectivec/objectivec_primitive_field.h>
 #include <google/protobuf/io/printer.h>
+#include <google/protobuf/stubs/strutil.h>
 #include <google/protobuf/wire_format.h>
 #include <google/protobuf/wire_format_lite_inl.h>
-#include <google/protobuf/stubs/strutil.h>
-#include <google/protobuf/stubs/substitute.h>
 
 namespace google {
 namespace protobuf {
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h b/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
index 69bb1fd..642f2d6 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
@@ -49,13 +49,13 @@
                           const Options& options);
   virtual ~PrimitiveFieldGenerator();
 
+  PrimitiveFieldGenerator(const PrimitiveFieldGenerator&) = delete;
+  PrimitiveFieldGenerator& operator=(const PrimitiveFieldGenerator&) = delete;
+
   virtual void GenerateFieldStorageDeclaration(io::Printer* printer) const;
 
   virtual int ExtraRuntimeHasBitsNeeded(void) const;
   virtual void SetExtraRuntimeHasBitsBase(int index_base);
-
- private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator);
 };
 
 class PrimitiveObjFieldGenerator : public ObjCObjFieldGenerator {
@@ -67,8 +67,9 @@
                              const Options& options);
   virtual ~PrimitiveObjFieldGenerator();
 
- private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveObjFieldGenerator);
+  PrimitiveObjFieldGenerator(const PrimitiveObjFieldGenerator&) = delete;
+  PrimitiveObjFieldGenerator& operator=(const PrimitiveObjFieldGenerator&) =
+      delete;
 };
 
 class RepeatedPrimitiveFieldGenerator : public RepeatedFieldGenerator {
@@ -80,8 +81,10 @@
                                   const Options& options);
   virtual ~RepeatedPrimitiveFieldGenerator();
 
- private:
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator);
+  RepeatedPrimitiveFieldGenerator(const RepeatedPrimitiveFieldGenerator&) =
+      delete;
+  RepeatedPrimitiveFieldGenerator& operator=(
+      const RepeatedPrimitiveFieldGenerator&) = delete;
 };
 
 }  // namespace objectivec