diff --git a/compiler/cpp/src/thrift/audit/t_audit.cpp b/compiler/cpp/src/thrift/audit/t_audit.cpp
index 4ae9a1f..fbce15c 100644
--- a/compiler/cpp/src/thrift/audit/t_audit.cpp
+++ b/compiler/cpp/src/thrift/audit/t_audit.cpp
@@ -54,18 +54,16 @@
    const std::map<std::string, std::string>& newNamespaceMap = newProgram->get_all_namespaces();
    const std::map<std::string, std::string>& oldNamespaceMap = oldProgram->get_all_namespaces();
 
-   for(auto oldNamespaceMapIt = oldNamespaceMap.begin();
-         oldNamespaceMapIt != oldNamespaceMap.end();
-         oldNamespaceMapIt++)
+   for(const auto & oldNamespaceMapIt : oldNamespaceMap)
    {
-      auto newNamespaceMapIt = newNamespaceMap.find(oldNamespaceMapIt->first);
+      auto newNamespaceMapIt = newNamespaceMap.find(oldNamespaceMapIt.first);
       if(newNamespaceMapIt == newNamespaceMap.end())
       {
-         thrift_audit_warning(1, "Language %s not found in new thrift file\n", (oldNamespaceMapIt->first).c_str());
+         thrift_audit_warning(1, "Language %s not found in new thrift file\n", (oldNamespaceMapIt.first).c_str());
       }
-      else if((newNamespaceMapIt->second) != oldNamespaceMapIt->second)
+      else if((newNamespaceMapIt->second) != oldNamespaceMapIt.second)
       {
-         thrift_audit_warning(1, "Namespace %s changed in new thrift file\n", (oldNamespaceMapIt->second).c_str());
+         thrift_audit_warning(1, "Namespace %s changed in new thrift file\n", (oldNamespaceMapIt.second).c_str());
       }
    }
 }
@@ -73,15 +71,13 @@
 void compare_enum_values(t_enum* newEnum,t_enum* oldEnum)
 {
    const std::vector<t_enum_value*>& oldEnumValues = oldEnum->get_constants();
-   for(auto oldEnumValuesIt = oldEnumValues.begin();
-         oldEnumValuesIt != oldEnumValues.end();
-         oldEnumValuesIt++)
+   for(auto oldEnumValue : oldEnumValues)
    {
-      int enumValue = (*oldEnumValuesIt)->get_value();
+      int enumValue = oldEnumValue->get_value();
       t_enum_value* newEnumValue = newEnum->get_constant_by_value(enumValue);
       if(newEnumValue != nullptr)
       {
-         std::string enumName = (*oldEnumValuesIt)->get_name();
+         std::string enumName = oldEnumValue->get_name();
          if(enumName != newEnumValue->get_name())
          {
             thrift_audit_warning(1, "Name of the value %d changed in enum %s\n", enumValue, oldEnum->get_name().c_str());
@@ -352,27 +348,23 @@
 {
    std::map<std::string, t_function*> newFunctionMap;
    std::map<std::string, t_function*>::iterator newFunctionMapIt;
-   for(auto newFunctionIt = newFunctionList.begin();
-         newFunctionIt != newFunctionList.end();
-         newFunctionIt++)
+   for(auto newFunctionIt : newFunctionList)
    {
-      newFunctionMap[(*newFunctionIt)->get_name()] = *newFunctionIt;
+      newFunctionMap[newFunctionIt->get_name()] = newFunctionIt;
    }
 
-   for(auto oldFunctionIt = oldFunctionList.begin();
-         oldFunctionIt != oldFunctionList.end();
-         oldFunctionIt++)
+   for(auto oldFunctionIt : oldFunctionList)
    {
-      newFunctionMapIt = newFunctionMap.find((*oldFunctionIt)->get_name());
+      newFunctionMapIt = newFunctionMap.find(oldFunctionIt->get_name());
       if(newFunctionMapIt == newFunctionMap.end())
       {
-         thrift_audit_failure("New Thrift File has missing function %s\n",(*oldFunctionIt)->get_name().c_str());
+         thrift_audit_failure("New Thrift File has missing function %s\n",oldFunctionIt->get_name().c_str());
          continue;
       }
       else
       {
          //Function is found in both thrift files. Compare return type and argument list
-         compare_single_function(newFunctionMapIt->second, *oldFunctionIt);
+         compare_single_function(newFunctionMapIt->second, oldFunctionIt);
       }
    }
 
@@ -383,11 +375,9 @@
    std::vector<t_service*>::const_iterator oldServiceIt;
 
    std::map<std::string, t_service*> newServiceMap;
-   for(auto newServiceIt = newServices.begin();
-         newServiceIt != newServices.end();
-         newServiceIt++)
+   for(auto newService : newServices)
    {
-      newServiceMap[(*newServiceIt)->get_name()] = *newServiceIt;
+      newServiceMap[newService->get_name()] = newService;
    }
 
 
diff --git a/compiler/cpp/src/thrift/generate/t_as3_generator.cc b/compiler/cpp/src/thrift/generate/t_as3_generator.cc
index 41724fe..dd4d166 100644
--- a/compiler/cpp/src/thrift/generate/t_as3_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_as3_generator.cc
@@ -68,20 +68,20 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
-  void generate_consts(std::vector<t_const*> consts);
+  void generate_consts(std::vector<t_const*> consts) override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   void print_const_value(std::ostream& out,
                          std::string name,
@@ -191,7 +191,7 @@
   std::string function_signature(t_function* tfunction, std::string prefix = "");
   std::string argument_list(t_struct* tstruct);
   std::string type_to_enum(t_type* ttype);
-  std::string get_enum_class_name(t_type* type);
+  std::string get_enum_class_name(t_type* type) override;
 
   bool type_can_be_null(t_type* ttype) {
     ttype = get_true_type(ttype);
@@ -2519,9 +2519,7 @@
 
   bool is_first = true;
   bool was_previous_char_upper = false;
-  for (string::iterator iter = name.begin(); iter != name.end(); ++iter) {
-    string::value_type character = (*iter);
-
+  for (char character : name) {
     bool is_upper = isupper(character);
 
     if (is_upper && !is_first && !was_previous_char_upper) {
diff --git a/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc b/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc
index 3060863..f1531cc 100644
--- a/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_c_glib_generator.cc
@@ -103,16 +103,16 @@
   }
 
   /* initialization and destruction */
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /* generation functions */
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_consts(vector<t_const*> consts);
-  void generate_struct(t_struct* tstruct);
-  void generate_service(t_service* tservice);
-  void generate_xception(t_struct* tstruct);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_consts(vector<t_const*> consts) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_service(t_service* tservice) override;
+  void generate_xception(t_struct* tstruct) override;
 
 private:
   /* file streams */
@@ -253,15 +253,13 @@
   if (!includes.empty()) {
     f_types_ << "/* other thrift includes */" << endl;
 
-    for (vector<t_program*>::const_iterator iter = includes.begin();
-         iter != includes.end();
-         ++iter) {
-      const std::string& include_nspace = (*iter)->get_namespace("c_glib");
+    for (auto include : includes) {
+      const std::string& include_nspace = include->get_namespace("c_glib");
       std::string include_nspace_prefix =
         include_nspace.empty() ? "" : initial_caps_to_underscores(include_nspace) + "_";
 
       f_types_ << "#include \"" << include_nspace_prefix
-               << initial_caps_to_underscores((*iter)->get_name()) << "_types.h\"" << endl;
+               << initial_caps_to_underscores(include->get_name()) << "_types.h\"" << endl;
     }
     f_types_ << endl;
   }
@@ -269,11 +267,11 @@
   /* include custom headers */
   const vector<string>& c_includes = program_->get_c_includes();
   f_types_ << "/* custom thrift includes */" << endl;
-  for (size_t i = 0; i < c_includes.size(); ++i) {
-    if (c_includes[i][0] == '<') {
-      f_types_ << "#include " << c_includes[i] << endl;
+  for (const auto & c_include : c_includes) {
+    if (c_include[0] == '<') {
+      f_types_ << "#include " << c_include << endl;
     } else {
-      f_types_ << "#include \"" << c_includes[i] << "\"" << endl;
+      f_types_ << "#include \"" << c_include << "\"" << endl;
     }
   }
   f_types_ << endl;
diff --git a/compiler/cpp/src/thrift/generate/t_cl_generator.cc b/compiler/cpp/src/thrift/generate/t_cl_generator.cc
index 38807f4..ad7c0ef 100644
--- a/compiler/cpp/src/thrift/generate/t_cl_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_cl_generator.cc
@@ -70,15 +70,15 @@
     copy_options_ = option_string;
   }
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
-  void generate_typedef     (t_typedef*  ttypedef);
-  void generate_enum        (t_enum*     tenum);
-  void generate_const       (t_const*    tconst);
-  void generate_struct      (t_struct*   tstruct);
-  void generate_xception    (t_struct*   txception);
-  void generate_service     (t_service*  tservice);
+  void generate_typedef     (t_typedef*  ttypedef) override;
+  void generate_enum        (t_enum*     tenum) override;
+  void generate_const       (t_const*    tconst) override;
+  void generate_struct      (t_struct*   tstruct) override;
+  void generate_xception    (t_struct*   txception) override;
+  void generate_service     (t_service*  tservice) override;
   void generate_cl_struct (std::ostream& out, t_struct* tstruct, bool is_exception);
   void generate_cl_struct_internal (std::ostream& out, t_struct* tstruct, bool is_exception);
   void generate_exception_sig(std::ostream& out, t_function* f);
@@ -128,9 +128,9 @@
   string f_types_name = program_dir + "/" + program_name_ + "-types.lisp";
   string f_vars_name = program_dir + "/" + program_name_ + "-vars.lisp";
 
-  f_types_.open(f_types_name.c_str());
+  f_types_.open(f_types_name);
   f_types_ << cl_autogen_comment() << endl;
-  f_vars_.open(f_vars_name.c_str());
+  f_vars_.open(f_vars_name);
   f_vars_ << cl_autogen_comment() << endl;
 
   package_def(f_types_);
@@ -139,7 +139,7 @@
 
   if (!no_asd) {
     string f_asd_name = program_dir + "/" + system_prefix + program_name_ + ".asd";
-    f_asd_.open(f_asd_name.c_str());
+    f_asd_.open(f_asd_name);
     f_asd_ << cl_autogen_comment() << endl;
     asdf_def(f_asd_);
   }
@@ -152,8 +152,8 @@
   const vector<t_program*>& includes = program_->get_includes();
   string result = "";
   result += ":depends-on (:thrift";
-  for (size_t i = 0; i < includes.size(); ++i) {
-    result += " :" + system_prefix + underscore(includes[i]->get_name());
+  for (auto include : includes) {
+    result += " :" + system_prefix + underscore(include->get_name());
   }
   result += ")\n";
   return result;
@@ -215,8 +215,8 @@
   out << "(thrift:def-package :" << package();
   if ( includes.size() > 0 ) {
     out << " :use (";
-    for (size_t i = 0; i < includes.size(); ++i) {
-      out << " :" << includes[i]->get_name();
+    for (auto include : includes) {
+      out << " :" << include->get_name();
     }
     out << ")";
   }
diff --git a/compiler/cpp/src/thrift/generate/t_cpp_generator.cc b/compiler/cpp/src/thrift/generate/t_cpp_generator.cc
index 617ba7e..dca3167 100644
--- a/compiler/cpp/src/thrift/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_cpp_generator.cc
@@ -101,25 +101,25 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
-  void generate_consts(std::vector<t_const*> consts);
+  void generate_consts(std::vector<t_const*> consts) override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
   void generate_enum_ostream_operator_decl(std::ostream& out, t_enum* tenum);
   void generate_enum_ostream_operator(std::ostream& out, t_enum* tenum);
-  void generate_forward_declaration(t_struct* tstruct);
-  void generate_struct(t_struct* tstruct) { generate_cpp_struct(tstruct, false); }
-  void generate_xception(t_struct* txception) { generate_cpp_struct(txception, true); }
+  void generate_forward_declaration(t_struct* tstruct) override;
+  void generate_struct(t_struct* tstruct) override { generate_cpp_struct(tstruct, false); }
+  void generate_xception(t_struct* txception) override { generate_cpp_struct(txception, true); }
   void generate_cpp_struct(t_struct* tstruct, bool is_exception);
 
-  void generate_service(t_service* tservice);
+  void generate_service(t_service* tservice) override;
 
   void print_const_value(std::ostream& out, std::string name, t_type* type, t_const_value* value);
   std::string render_const_value(std::ostream& out,
@@ -424,24 +424,24 @@
 
   // Include other Thrift includes
   const vector<t_program*>& includes = program_->get_includes();
-  for (size_t i = 0; i < includes.size(); ++i) {
-    f_types_ << "#include \"" << get_include_prefix(*(includes[i])) << includes[i]->get_name()
+  for (auto include : includes) {
+    f_types_ << "#include \"" << get_include_prefix(*include) << include->get_name()
              << "_types.h\"" << endl;
 
     // XXX(simpkins): If gen_templates_ is enabled, we currently assume all
     // included files were also generated with templates enabled.
-    f_types_tcc_ << "#include \"" << get_include_prefix(*(includes[i])) << includes[i]->get_name()
+    f_types_tcc_ << "#include \"" << get_include_prefix(*include) << include->get_name()
                  << "_types.tcc\"" << endl;
   }
   f_types_ << endl;
 
   // Include custom headers
   const vector<string>& cpp_includes = program_->get_cpp_includes();
-  for (size_t i = 0; i < cpp_includes.size(); ++i) {
-    if (cpp_includes[i][0] == '<') {
-      f_types_ << "#include " << cpp_includes[i] << endl;
+  for (const auto & cpp_include : cpp_includes) {
+    if (cpp_include[0] == '<') {
+      f_types_ << "#include " << cpp_include << endl;
     } else {
-      f_types_ << "#include \"" << cpp_includes[i] << "\"" << endl;
+      f_types_ << "#include \"" << cpp_include << "\"" << endl;
     }
   }
   f_types_ << endl;
@@ -1238,7 +1238,6 @@
   if (setters) {
     for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
       if (is_reference((*m_iter))) {
-        std::string type = type_name((*m_iter)->get_type());
         out << endl << indent() << "void " << tstruct->get_name() << "::__set_"
             << (*m_iter)->get_name() << "(::std::shared_ptr<"
             << type_name((*m_iter)->get_type(), false, false) << ">";
@@ -1538,9 +1537,7 @@
 
   bool has_nonrequired_fields = false;
   const vector<t_field*>& fields = tstruct->get_members();
-  for (vector<t_field*>::const_iterator f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    t_field* tfield = *f_iter;
-
+  for (auto tfield : fields) {
     if (tfield->get_req() != t_field::T_REQUIRED) {
       has_nonrequired_fields = true;
     }
diff --git a/compiler/cpp/src/thrift/generate/t_csharp_generator.cc b/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
index 6e99a3e..e4d99b2 100644
--- a/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
@@ -89,17 +89,17 @@
 
     out_dir_base_ = "gen-csharp";
   }
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
-  void generate_consts(std::vector<t_const*> consts);
+  void generate_consts(std::vector<t_const*> consts) override;
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_struct(t_struct* tstruct);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_struct(t_struct* tstruct) override;
   void generate_union(t_struct* tunion);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
   void generate_property(ostream& out, t_field* tfield, bool isPublic, bool generateIsset);
   void generate_csharp_property(ostream& out,
                                 t_field* tfield,
@@ -207,7 +207,7 @@
   std::string argument_list(t_struct* tstruct);
   std::string type_to_enum(t_type* ttype);
   std::string prop_name(t_field* tfield, bool suppress_mapping = false);
-  std::string get_enum_class_name(t_type* type);
+  std::string get_enum_class_name(t_type* type) override;
 
   bool field_has_default(t_field* tfield) { return tfield->get_value() != NULL; }
 
diff --git a/compiler/cpp/src/thrift/generate/t_d_generator.cc b/compiler/cpp/src/thrift/generate/t_d_generator.cc
index df56cfc..56519e4 100644
--- a/compiler/cpp/src/thrift/generate/t_d_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_d_generator.cc
@@ -71,7 +71,7 @@
   }
 
 protected:
-  virtual void init_generator() {
+  void init_generator() override {
     // Make output directory
     MKDIR(get_out_dir().c_str());
 
@@ -102,20 +102,20 @@
 
     // Include type modules from other imported programs.
     const vector<t_program*>& includes = program_->get_includes();
-    for (size_t i = 0; i < includes.size(); ++i) {
-      f_types_ << "public import " << render_package(*(includes[i])) << includes[i]->get_name()
+    for (auto include : includes) {
+      f_types_ << "public import " << render_package(*include) << include->get_name()
                << "_types;" << endl;
     }
     if (!includes.empty())
       f_types_ << endl;
   }
 
-  virtual void close_generator() {
+  void close_generator() override {
     // Close output file
     f_types_.close();
   }
 
-  virtual void generate_consts(std::vector<t_const*> consts) {
+  void generate_consts(std::vector<t_const*> consts) override {
     if (!consts.empty()) {
       string f_consts_name = package_dir_ + program_name_ + "_constants.d";
       ofstream_with_content_based_conditional_update f_consts;
@@ -159,13 +159,13 @@
     }
   }
 
-  virtual void generate_typedef(t_typedef* ttypedef) {
+  void generate_typedef(t_typedef* ttypedef) override {
     this->emit_doc(ttypedef, f_types_);
     f_types_ << indent() << "alias " << render_type_name(ttypedef->get_type()) << " "
              << ttypedef->get_symbolic() << ";" << endl << endl;
   }
 
-  virtual void generate_enum(t_enum* tenum) {
+  void generate_enum(t_enum* tenum) override {
     vector<t_enum_value*> constants = tenum->get_constants();
 
     this->emit_doc(tenum, f_types_);
@@ -188,15 +188,15 @@
     f_types_ << endl;
   }
 
-  virtual void generate_struct(t_struct* tstruct) {
+  void generate_struct(t_struct* tstruct) override {
     print_struct_definition(f_types_, tstruct, false);
   }
 
-  virtual void generate_xception(t_struct* txception) {
+  void generate_xception(t_struct* txception) override {
     print_struct_definition(f_types_, txception, true);
   }
 
-  virtual void generate_service(t_service* tservice) {
+  void generate_service(t_service* tservice) override {
     string svc_name = tservice->get_name();
 
     // Service implementation file includes
diff --git a/compiler/cpp/src/thrift/generate/t_dart_generator.cc b/compiler/cpp/src/thrift/generate/t_dart_generator.cc
index c82d26c..fbbb9e6 100644
--- a/compiler/cpp/src/thrift/generate/t_dart_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_dart_generator.cc
@@ -121,25 +121,25 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   void export_class_to_library(string file_name, string class_name);
 
   void generate_dart_library();
   void generate_dart_pubspec();
 
-  void generate_consts(std::vector<t_const*> consts);
+  void generate_consts(std::vector<t_const*> consts) override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   void print_const_value(std::ostream& out,
                          std::string name,
@@ -359,8 +359,8 @@
 
   // add imports for included thrift files
   const vector<t_program*>& includes = program_->get_includes();
-  for (size_t i = 0; i < includes.size(); ++i) {
-    string include_name = find_library_name(includes[i]);
+  for (auto include : includes) {
+    string include_name = find_library_name(include);
     string named_import = "t_" + include_name;
     if (package_prefix_.empty()) {
       imports += "import 'package:" + include_name + "/" + include_name + ".dart' as " + named_import + ";" + endl;
@@ -438,15 +438,15 @@
     indent_down();
   } else {
     const vector<std::string> lines = split(pubspec_lib_, '|');
-    for (size_t line_index = 0; line_index < lines.size(); line_index++) {
-      indent(f_pubspec) << lines[line_index] << endl;
+    for (const auto & line : lines) {
+      indent(f_pubspec) << line << endl;
     }
   }
 
   // add included thrift files as dependencies
   const vector<t_program*>& includes = program_->get_includes();
-  for (size_t i = 0; i < includes.size(); ++i) {
-    string include_name = find_library_name(includes[i]);
+  for (auto include : includes) {
+    string include_name = find_library_name(include);
     indent(f_pubspec) << include_name << ":" << endl;
     indent_up();
     indent(f_pubspec) << "path: ../" << include_name << endl;
@@ -2432,9 +2432,7 @@
 
   bool is_first = true;
   bool was_previous_char_upper = false;
-  for (string::iterator iter = name.begin(); iter != name.end(); ++iter) {
-    string::value_type character = (*iter);
-
+  for (char character : name) {
     bool is_upper = isupper(character);
 
     if (is_upper && !is_first && !was_previous_char_upper) {
diff --git a/compiler/cpp/src/thrift/generate/t_delphi_generator.cc b/compiler/cpp/src/thrift/generate/t_delphi_generator.cc
index 737aa5a..505120e 100644
--- a/compiler/cpp/src/thrift/generate/t_delphi_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_delphi_generator.cc
@@ -89,17 +89,17 @@
     escape_['\''] = "''";
   }
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
-  void generate_consts(std::vector<t_const*> consts);
+  void generate_consts(std::vector<t_const*> consts) override;
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_forward_declaration(t_struct* tstruct);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_forward_declaration(t_struct* tstruct) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
   void generate_property(ostream& out, t_field* tfield, bool isPublic, bool is_xception);
   void generate_property_writer_(ostream& out, t_field* tfield, bool isPublic);
 
@@ -343,7 +343,7 @@
   void write_struct(std::string line);
   void write_service(std::string line);
 
-  virtual std::string autogen_comment() {
+  std::string autogen_comment() override {
     return std::string("(**\n") + " * Autogenerated by Thrift Compiler (" + THRIFT_VERSION + ")\n"
            + " *\n" + " * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n"
            + " *)\n";
@@ -757,9 +757,9 @@
 
   string unitname, nsname;
   const vector<t_program*>& includes = program_->get_includes();
-  for (size_t i = 0; i < includes.size(); ++i) {
-    unitname = includes[i]->get_name();
-    nsname = includes[i]->get_namespace("delphi");
+  for (auto include : includes) {
+    unitname = include->get_name();
+    nsname = include->get_namespace("delphi");
     if ("" != nsname) {
       unitname = normalize_name(nsname);
     }
@@ -786,7 +786,7 @@
   std::string f_name = get_out_dir() + "/" + unitname + ".pas";
   ofstream_with_content_based_conditional_update f_all;
 
-  f_all.open(f_name.c_str());
+  f_all.open(f_name);
 
   f_all << autogen_comment() << endl;
   generate_delphi_doc(f_all, program_);
diff --git a/compiler/cpp/src/thrift/generate/t_erl_generator.cc b/compiler/cpp/src/thrift/generate/t_erl_generator.cc
index d4fe12c..d331ecc 100644
--- a/compiler/cpp/src/thrift/generate/t_erl_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_erl_generator.cc
@@ -83,19 +83,19 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
   void generate_member_type(std::ostream& out, t_type* type);
   void generate_member_value(std::ostream& out, t_type* type, t_const_value* value);
 
@@ -310,8 +310,8 @@
 string t_erl_generator::render_includes() {
   const vector<t_program*>& includes = program_->get_includes();
   string result = "";
-  for (size_t i = 0; i < includes.size(); ++i) {
-    result += "-include(\"" + make_safe_for_module_name(includes[i]->get_name())
+  for (auto include : includes) {
+    result += "-include(\"" + make_safe_for_module_name(include->get_name())
               + "_types.hrl\").\n";
   }
   if (includes.size() > 0) {
diff --git a/compiler/cpp/src/thrift/generate/t_go_generator.cc b/compiler/cpp/src/thrift/generate/t_go_generator.cc
index 11246f3..66bb653 100644
--- a/compiler/cpp/src/thrift/generate/t_go_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_go_generator.cc
@@ -105,19 +105,19 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   std::string render_const_value(t_type* type, t_const_value* value, const string& name, bool opt = false);
 
@@ -743,10 +743,10 @@
 
   // Make output files
   f_types_name_ = package_dir_ + "/" + program_name_ + ".go";
-  f_types_.open(f_types_name_.c_str());
+  f_types_.open(f_types_name_);
 
   f_consts_name_ = package_dir_ + "/" + program_name_ + "-consts.go";
-  f_consts_.open(f_consts_name_.c_str());
+  f_consts_.open(f_consts_name_);
 
   // Print header
   f_types_ << go_autogen_comment() << go_package() << render_includes(false);
@@ -771,12 +771,12 @@
   unused_protection = "";
 
   string local_namespace = program_->get_namespace("go");
-  for (size_t i = 0; i < includes.size(); ++i) {
-    if (!local_namespace.empty() && local_namespace == includes[i]->get_namespace("go")) {
+  for (auto include : includes) {
+    if (!local_namespace.empty() && local_namespace == include->get_namespace("go")) {
       continue;
     }
 
-    string go_module = get_real_go_module(includes[i]);
+    string go_module = get_real_go_module(include);
     size_t found = 0;
     for (size_t j = 0; j < go_module.size(); j++) {
       // Import statement uses slashes ('/') in namespace
@@ -803,12 +803,12 @@
   string unused_prot = "";
 
   string local_namespace = program_->get_namespace("go");
-  for (size_t i = 0; i < includes.size(); ++i) {
-    if (!local_namespace.empty() && local_namespace == includes[i]->get_namespace("go")) {
+  for (auto include : includes) {
+    if (!local_namespace.empty() && local_namespace == include->get_namespace("go")) {
       continue;
     }
 
-    string go_module = get_real_go_module(includes[i]);
+    string go_module = get_real_go_module(include);
     size_t found = 0;
     for (size_t j = 0; j < go_module.size(); j++) {
       // Import statement uses slashes ('/') in namespace
@@ -1255,15 +1255,14 @@
                                                     bool is_args_or_result) {
   out << publicize(type_name(tstruct), is_args_or_result) << "{";
   const vector<t_field*>& members = tstruct->get_members();
-  for (vector<t_field*>::const_iterator m_iter = members.begin(); m_iter != members.end();
-       ++m_iter) {
-    bool pointer_field = is_pointer_field(*m_iter);
+  for (auto member : members) {
+    bool pointer_field = is_pointer_field(member);
     string publicized_name;
     t_const_value* def_value;
-    get_publicized_name_and_def_value(*m_iter, &publicized_name, &def_value);
-    if (!pointer_field && def_value != NULL && !omit_initialization(*m_iter)) {
+    get_publicized_name_and_def_value(member, &publicized_name, &def_value);
+    if (!pointer_field && def_value != NULL && !omit_initialization(member)) {
       out << endl << indent() << publicized_name << ": "
-          << render_field_initial_value(*m_iter, (*m_iter)->get_name(), pointer_field) << ","
+          << render_field_initial_value(member, member->get_name(), pointer_field) << ","
           << endl;
     }
   }
diff --git a/compiler/cpp/src/thrift/generate/t_gv_generator.cc b/compiler/cpp/src/thrift/generate/t_gv_generator.cc
index 7f8301a..2c0acf9 100644
--- a/compiler/cpp/src/thrift/generate/t_gv_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_gv_generator.cc
@@ -67,17 +67,17 @@
   /**
    * Init and end of generator
    */
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_service(t_service* tservice) override;
 
 protected:
   /**
diff --git a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
index 3b88c4d..13f2cd1 100644
--- a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
@@ -74,20 +74,20 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
-  void generate_consts(std::vector<t_const*> consts);
+  void generate_consts(std::vector<t_const*> consts) override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   void print_const_value(std::ostream& out,
                          std::string name,
@@ -190,7 +190,7 @@
   std::string function_signature_normal(t_function* tfunction);
   std::string argument_list(t_struct* tstruct);
   std::string type_to_enum(t_type* ttype);
-  std::string get_enum_class_name(t_type* type);
+  std::string get_enum_class_name(t_type* type) override;
   string generate_service_method_onsuccess(t_function* tfunction, bool as_type, bool omit_name);
   void generate_service_method_signature_callback(t_function* tfunction, bool is_interface);
   void generate_service_method_signature_normal(t_function* tfunction, bool is_interface);
@@ -2884,9 +2884,7 @@
 
   bool is_first = true;
   bool was_previous_char_upper = false;
-  for (string::iterator iter = name.begin(); iter != name.end(); ++iter) {
-    string::value_type character = (*iter);
-
+  for (char character : name) {
     bool is_upper = isupper(character);
 
     if (is_upper && !is_first && !was_previous_char_upper) {
diff --git a/compiler/cpp/src/thrift/generate/t_hs_generator.cc b/compiler/cpp/src/thrift/generate/t_hs_generator.cc
index 8f6d4b0..a59dee5 100644
--- a/compiler/cpp/src/thrift/generate/t_hs_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_hs_generator.cc
@@ -66,18 +66,18 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   string render_const_value(t_type* type, t_const_value* value);
 
@@ -261,8 +261,8 @@
       "import qualified Thrift.Arbitraries as T\n"
       "\n");
 
-  for (size_t i = 0; i < includes.size(); ++i)
-    result += "import qualified " + capitalize(includes[i]->get_name()) + "_Types\n";
+  for (auto include : includes)
+    result += "import qualified " + capitalize(include->get_name()) + "_Types\n";
 
   if (includes.size() > 0)
     result += "\n";
@@ -407,14 +407,13 @@
   } else if (type->is_enum()) {
     t_enum* tenum = (t_enum*)type;
     vector<t_enum_value*> constants = tenum->get_constants();
-    for (vector<t_enum_value*>::iterator c_iter = constants.begin(); c_iter != constants.end();
-         ++c_iter) {
-      int val = (*c_iter)->get_value();
+    for (auto & constant : constants) {
+      int val = constant->get_value();
       if (val == value->get_integer()) {
         t_program* prog = type->get_program();
         if (prog != NULL && prog != program_)
           out << capitalize(prog->get_name()) << "_Types.";
-        out << capitalize((*c_iter)->get_name());
+        out << capitalize(constant->get_name());
         break;
       }
     }
@@ -427,21 +426,18 @@
     const map<t_const_value*, t_const_value*, t_const_value::value_compare>& val = value->get_map();
 
     bool first = true;
-    for (map<t_const_value*, t_const_value*, t_const_value::value_compare>::const_iterator v_iter = val.begin();
-         v_iter != val.end();
-         ++v_iter) {
+    for (auto v_iter : val) {
       t_field* field = NULL;
 
-      for (vector<t_field*>::const_iterator f_iter = fields.begin(); f_iter != fields.end();
-           ++f_iter)
-        if ((*f_iter)->get_name() == v_iter->first->get_string())
-          field = (*f_iter);
+      for (auto f_iter : fields)
+        if (f_iter->get_name() == v_iter.first->get_string())
+          field = f_iter;
 
       if (field == NULL)
-        throw "type error: " + cname + " has no field " + v_iter->first->get_string();
+        throw "type error: " + cname + " has no field " + v_iter.first->get_string();
 
-      string fname = v_iter->first->get_string();
-      string const_value = render_const_value(field->get_type(), v_iter->second);
+      string fname = v_iter.first->get_string();
+      string const_value = render_const_value(field->get_type(), v_iter.second);
 
       out << (first ? "" : ", ");
       out << field_name(cname, fname) << " = ";
@@ -543,21 +539,20 @@
   if (members.size() > 0) {
     indent_up();
     bool first = true;
-    for (vector<t_field*>::const_iterator m_iter = members.begin(); m_iter != members.end();
-         ++m_iter) {
+    for (auto member : members) {
       if (first) {
         indent(out) << "{ ";
         first = false;
       } else {
         indent(out) << ", ";
       }
-      string mname = (*m_iter)->get_name();
+      string mname = member->get_name();
       out << field_name(tname, mname) << " :: ";
-      if ((*m_iter)->get_req() == t_field::T_OPTIONAL
-          || ((t_type*)(*m_iter)->get_type())->is_xception()) {
+      if (member->get_req() == t_field::T_OPTIONAL
+          || ((t_type*)member->get_type())->is_xception()) {
         out << "P.Maybe ";
       }
-      out << render_hs_type((*m_iter)->get_type(), true) << endl;
+      out << render_hs_type(member->get_type(), true) << endl;
     }
     indent(out) << "}";
     indent_down();
@@ -571,9 +566,8 @@
   indent(out) << "instance H.Hashable " << tname << " where" << endl;
   indent_up();
   indent(out) << "hashWithSalt salt record = salt";
-  for (vector<t_field*>::const_iterator m_iter = members.begin(); m_iter != members.end();
-       ++m_iter) {
-    string mname = (*m_iter)->get_name();
+  for (auto member : members) {
+    string mname = member->get_name();
     indent(out) << " `H.hashWithSalt` " << field_name(tname, mname) << " record";
   }
   indent(out) << endl;
@@ -600,8 +594,7 @@
     indent_up();
     indent_up();
     bool first = true;
-    for (vector<t_field*>::const_iterator m_iter = members.begin(); m_iter != members.end();
-         ++m_iter) {
+    for (auto member : members) {
       if (first) {
         first = false;
         out << " ";
@@ -609,8 +602,8 @@
         indent(out) << "`M.ap`";
       }
       out << "(";
-      if ((*m_iter)->get_req() == t_field::T_OPTIONAL
-          || ((t_type*)(*m_iter)->get_type())->is_xception()) {
+      if (member->get_req() == t_field::T_OPTIONAL
+          || ((t_type*)member->get_type())->is_xception()) {
         out << "M.liftM P.Just ";
       }
       out << "QC.arbitrary)" << endl;
@@ -625,15 +618,14 @@
     indent(out) << "           | P.otherwise = M.catMaybes" << endl;
     indent_up();
     first = true;
-    for (vector<t_field*>::const_iterator m_iter = members.begin(); m_iter != members.end();
-         ++m_iter) {
+    for (auto member : members) {
       if (first) {
         first = false;
         indent(out) << "[ ";
       } else {
         indent(out) << ", ";
       }
-      string fname = field_name(tname, (*m_iter)->get_name());
+      string fname = field_name(tname, member->get_name());
       out << "if obj == default_" << tname;
       out << "{" << fname << " = " << fname << " obj} ";
       out << "then P.Nothing ";
@@ -665,10 +657,10 @@
   bool first = true;
 
   // Generate deserialization code for known cases
-  for (vector<t_field*>::const_iterator f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    int32_t key = (*f_iter)->get_key();
-    string etype = type_to_enum((*f_iter)->get_type());
-    string fname = (*f_iter)->get_name();
+  for (auto field : fields) {
+    int32_t key = field->get_key();
+    string etype = type_to_enum(field->get_type());
+    string fname = field->get_name();
 
     if (first) {
       first = false;
@@ -680,11 +672,11 @@
     indent(out) << field_name(sname, fname) << " = ";
 
     out << "P.maybe (";
-    if ((*f_iter)->get_req() == t_field::T_REQUIRED) {
+    if (field->get_req() == t_field::T_REQUIRED) {
       out << "P.error \"Missing required field: " << fname << "\"";
     } else {
-      if (((*f_iter)->get_req() == t_field::T_OPTIONAL
-           || ((t_type*)(*f_iter)->get_type())->is_xception()) && (*f_iter)->get_value() == NULL) {
+      if ((field->get_req() == t_field::T_OPTIONAL
+           || ((t_type*)field->get_type())->is_xception()) && field->get_value() == NULL) {
         out << "P.Nothing";
       } else {
         out << field_name(sname, fname) << " default_" << sname;
@@ -693,10 +685,10 @@
     out << ") ";
 
     out << "(\\(_," << val << ") -> ";
-    if ((*f_iter)->get_req() == t_field::T_OPTIONAL
-        || ((t_type*)(*f_iter)->get_type())->is_xception())
+    if (field->get_req() == t_field::T_OPTIONAL
+        || ((t_type*)field->get_type())->is_xception())
       out << "P.Just ";
-    generate_deserialize_field(out, *f_iter, val);
+    generate_deserialize_field(out, field, val);
     out << ")";
     out << " (Map.lookup (" << key << ") fields)";
   }
@@ -733,8 +725,8 @@
 
   // Get Exceptions
   bool hasExn = false;
-  for (vector<t_field*>::const_iterator f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    if (((t_type*)(*f_iter)->get_type())->is_xception()) {
+  for (auto field : fields) {
+    if (((t_type*)field->get_type())->is_xception()) {
       hasExn = true;
       break;
     }
@@ -745,19 +737,18 @@
     out << endl;
     indent(out) << "(let exns = M.catMaybes ";
     indent_up();
-    for (vector<t_field*>::const_iterator f_iter = fields.begin(); f_iter != fields.end();
-         ++f_iter) {
-      if (((t_type*)(*f_iter)->get_type())->is_xception()) {
+    for (auto field : fields) {
+      if (((t_type*)field->get_type())->is_xception()) {
         if (isfirst) {
           out << "[ ";
           isfirst = false;
         } else {
           out << ", ";
         }
-        string mname = (*f_iter)->get_name();
-        int32_t key = (*f_iter)->get_key();
+        string mname = field->get_name();
+        int32_t key = field->get_key();
         out << "(\\" << v << " -> (" << key << ", (\"" << mname << "\",";
-        generate_serialize_type(out, (*f_iter)->get_type(), v);
+        generate_serialize_type(out, field->get_type(), v);
         out << "))) <$> " << field_name(name, mname) << " record";
       }
     }
@@ -774,7 +765,7 @@
   out << "M.catMaybes" << endl;
   // Get the Rest
   isfirst = true;
-  for (vector<t_field*>::const_iterator f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
+  for (auto field : fields) {
     // Write field header
     if (isfirst) {
       indent(out) << "[ ";
@@ -782,19 +773,19 @@
     } else {
       indent(out) << ", ";
     }
-    string mname = (*f_iter)->get_name();
-    int32_t key = (*f_iter)->get_key();
+    string mname = field->get_name();
+    int32_t key = field->get_key();
     out << "(\\";
     out << v << " -> ";
-    if ((*f_iter)->get_req() != t_field::T_OPTIONAL
-        && !((t_type*)(*f_iter)->get_type())->is_xception()) {
+    if (field->get_req() != t_field::T_OPTIONAL
+        && !((t_type*)field->get_type())->is_xception()) {
       out << "P.Just ";
     }
     out << "(" << key << ", (\"" << mname << "\",";
-    generate_serialize_type(out, (*f_iter)->get_type(), v);
+    generate_serialize_type(out, field->get_type(), v);
     out << "))) ";
-    if ((*f_iter)->get_req() != t_field::T_OPTIONAL
-        && !((t_type*)(*f_iter)->get_type())->is_xception()) {
+    if (field->get_req() != t_field::T_OPTIONAL
+        && !((t_type*)field->get_type())->is_xception()) {
       out << "$";
     } else {
       out << "<$>";
@@ -910,14 +901,14 @@
   indent(out) << "typemap_" << name << " :: T.TypeMap" << endl;
   indent(out) << "typemap_" << name << " = Map.fromList [";
   bool first = true;
-  for (vector<t_field*>::const_iterator f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    string mname = (*f_iter)->get_name();
+  for (auto field : fields) {
+    string mname = field->get_name();
     if (!first) {
       out << ",";
     }
 
-    t_type* type = get_true_type((*f_iter)->get_type());
-    int32_t key = (*f_iter)->get_key();
+    t_type* type = get_true_type(field->get_type());
+    int32_t key = field->get_key();
     out << "(" << key << ",(\"" << mname << "\"," << type_to_enum(type) << "))";
     first = false;
   }
@@ -937,19 +928,19 @@
   indent(out) << fname << " = " << name << "{" << endl;
   indent_up();
   bool first = true;
-  for (vector<t_field*>::const_iterator f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    string mname = (*f_iter)->get_name();
+  for (auto field : fields) {
+    string mname = field->get_name();
     if (first) {
       first = false;
     } else {
       out << "," << endl;
     }
 
-    t_type* type = get_true_type((*f_iter)->get_type());
-    t_const_value* value = (*f_iter)->get_value();
+    t_type* type = get_true_type(field->get_type());
+    t_const_value* value = field->get_value();
     indent(out) << field_name(name, mname) << " = ";
-    if ((*f_iter)->get_req() == t_field::T_OPTIONAL
-        || ((t_type*)(*f_iter)->get_type())->is_xception()) {
+    if (field->get_req() == t_field::T_OPTIONAL
+        || ((t_type*)field->get_type())->is_xception()) {
       if (value == NULL) {
         out << "P.Nothing";
       } else {
@@ -1087,13 +1078,12 @@
     indent(f_client_) << "write_" << argsname << " op (" << argsname << "{";
 
     bool first = true;
-    for (vector<t_field*>::const_iterator fld_iter = fields.begin(); fld_iter != fields.end();
-         ++fld_iter) {
-      string fieldname = (*fld_iter)->get_name();
+    for (auto field : fields) {
+      string fieldname = field->get_name();
       f_client_ << (first ? "" : ",");
       f_client_ << field_name(argsname, fieldname) << "=";
-      if ((*fld_iter)->get_req() == t_field::T_OPTIONAL
-          || ((t_type*)(*fld_iter)->get_type())->is_xception())
+      if (field->get_req() == t_field::T_OPTIONAL
+          || ((t_type*)field->get_type())->is_xception())
         f_client_ << "P.Just ";
       f_client_ << "arg_" << fieldname;
       first = false;
@@ -1123,10 +1113,9 @@
       t_struct* xs = (*f_iter)->get_xceptions();
       const vector<t_field*>& xceptions = xs->get_members();
 
-      for (vector<t_field*>::const_iterator x_iter = xceptions.begin(); x_iter != xceptions.end();
-           ++x_iter) {
+      for (auto xception : xceptions) {
         indent(f_client_) << "P.maybe (P.return ()) X.throw ("
-                          << field_name(resultname, (*x_iter)->get_name()) << " res)" << endl;
+                          << field_name(resultname, xception->get_name()) << " res)" << endl;
       }
 
       if (!(*f_iter)->get_returntype()->is_void())
@@ -1499,11 +1488,11 @@
   string result = "";
 
   const vector<t_field*>& fields = tfunc->get_arglist()->get_members();
-  for (vector<t_field*>::const_iterator f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    if ((*f_iter)->get_req() == t_field::T_OPTIONAL
-        || ((t_type*)(*f_iter)->get_type())->is_xception())
+  for (auto field : fields) {
+    if (field->get_req() == t_field::T_OPTIONAL
+        || ((t_type*)field->get_type())->is_xception())
       result += "P.Maybe ";
-    result += render_hs_type((*f_iter)->get_type(), options);
+    result += render_hs_type(field->get_type(), options);
     result += " -> ";
   }
 
diff --git a/compiler/cpp/src/thrift/generate/t_html_generator.cc b/compiler/cpp/src/thrift/generate/t_html_generator.cc
index 00c9a0a..b61a712 100644
--- a/compiler/cpp/src/thrift/generate/t_html_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_html_generator.cc
@@ -82,7 +82,7 @@
     init_allowed__markup();
   }
 
-  void generate_program();
+  void generate_program() override;
   void generate_program_toc();
   void generate_program_toc_row(t_program* tprog);
   void generate_program_toc_rows(t_program* tprog, std::vector<t_program*>& finished);
@@ -101,12 +101,12 @@
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_service(t_service* tservice);
-  void generate_xception(t_struct* txception);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_service(t_service* tservice) override;
+  void generate_xception(t_struct* txception) override;
 
   void print_doc(t_doc* tdoc);
   int print_type(t_type* ttype);
@@ -140,16 +140,16 @@
  */
 void t_html_generator::generate_program_toc_rows(t_program* tprog,
                                                  std::vector<t_program*>& finished) {
-  for (vector<t_program*>::iterator iter = finished.begin(); iter != finished.end(); iter++) {
-    if (tprog->get_path() == (*iter)->get_path()) {
+  for (auto & iter : finished) {
+    if (tprog->get_path() == iter->get_path()) {
       return;
     }
   }
   finished.push_back(tprog);
   generate_program_toc_row(tprog);
   vector<t_program*> includes = tprog->get_includes();
-  for (vector<t_program*>::iterator iter = includes.begin(); iter != includes.end(); iter++) {
-    generate_program_toc_rows(*iter, finished);
+  for (auto & include : includes) {
+    generate_program_toc_rows(include, finished);
   }
 }
 
@@ -176,9 +176,8 @@
                       + "\">" + fn_name + "</a></li>";
         fn_html.insert(pair<string, string>(fn_name, html));
       }
-      for (map<string, string>::iterator html_iter = fn_html.begin(); html_iter != fn_html.end();
-           html_iter++) {
-        f_out_ << html_iter->second << endl;
+      for (auto & html_iter : fn_html) {
+        f_out_ << html_iter.second << endl;
       }
       f_out_ << "</ul>" << endl;
     }
@@ -220,9 +219,8 @@
       data_types.insert(pair<string, string>(name, html));
     }
   }
-  for (map<string, string>::iterator dt_iter = data_types.begin(); dt_iter != data_types.end();
-       dt_iter++) {
-    f_out_ << dt_iter->second << "<br/>" << endl;
+  for (auto & data_type : data_types) {
+    f_out_ << data_type.second << "<br/>" << endl;
   }
   f_out_ << "</td>" << endl << "<td>";
   if (!tprog->get_consts().empty()) {
@@ -235,9 +233,8 @@
                     + "</a></code>";
       const_html.insert(pair<string, string>(name, html));
     }
-    for (map<string, string>::iterator con_iter = const_html.begin(); con_iter != const_html.end();
-         con_iter++) {
-      f_out_ << con_iter->second << "<br/>" << endl;
+    for (auto & con_iter : const_html) {
+      f_out_ << con_iter.second << "<br/>" << endl;
     }
   }
   f_out_ << "</td>" << endl << "</tr>";
@@ -572,8 +569,8 @@
     if (first_white != string::npos) {
       tag_key.erase(first_white);
     }
-    for (std::string::size_type i = 0; i < tag_key.length(); ++i) {
-      tag_key[i] = tolower(tag_key[i]);
+    for (char & i : tag_key) {
+      i = tolower(i);
     }
     if (allowed_markup.find(tag_key) != allowed_markup.end()) {
       result << "<" << tag_content << ">";
diff --git a/compiler/cpp/src/thrift/generate/t_java_generator.cc b/compiler/cpp/src/thrift/generate/t_java_generator.cc
index 2c84551..2fb1f1a 100644
--- a/compiler/cpp/src/thrift/generate/t_java_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_java_generator.cc
@@ -122,21 +122,21 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
-  void generate_consts(std::vector<t_const*> consts);
+  void generate_consts(std::vector<t_const*> consts) override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_struct(t_struct* tstruct);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_struct(t_struct* tstruct) override;
   void generate_union(t_struct* tunion);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   void print_const_value(std::ostream& out,
                          std::string name,
@@ -4652,9 +4652,7 @@
 
   bool is_first = true;
   bool was_previous_char_upper = false;
-  for (string::iterator iter = name.begin(); iter != name.end(); ++iter) {
-    string::value_type character = (*iter);
-
+  for (char character : name) {
     bool is_upper = isupper(character);
 
     if (is_upper && !is_first && !was_previous_char_upper) {
diff --git a/compiler/cpp/src/thrift/generate/t_javame_generator.cc b/compiler/cpp/src/thrift/generate/t_javame_generator.cc
index fa743ca..e1694ab 100644
--- a/compiler/cpp/src/thrift/generate/t_javame_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_javame_generator.cc
@@ -65,21 +65,21 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
-  void generate_consts(std::vector<t_const*> consts);
+  void generate_consts(std::vector<t_const*> consts) override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_struct(t_struct* tstruct);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_struct(t_struct* tstruct) override;
   void generate_union(t_struct* tunion);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   void print_const_value(std::ostream& out,
                          std::string name,
@@ -185,13 +185,13 @@
 
   void generate_serialize_list_element(std::ostream& out, t_list* tlist, std::string iter);
 
-  void generate_java_doc(std::ostream& out, t_field* field);
+  void generate_java_doc(std::ostream& out, t_field* field) override;
 
-  void generate_java_doc(std::ostream& out, t_doc* tdoc);
+  void generate_java_doc(std::ostream& out, t_doc* tdoc) override;
 
-  void generate_java_doc(std::ostream& out, t_function* tdoc);
+  void generate_java_doc(std::ostream& out, t_function* tdoc) override;
 
-  void generate_java_docstring_comment(std::ostream& out, string contents);
+  void generate_java_docstring_comment(std::ostream& out, string contents) override;
 
   void generate_deep_copy_container(std::ostream& out,
                                     std::string source_name_p1,
@@ -221,7 +221,7 @@
   std::string function_signature(t_function* tfunction, std::string prefix = "");
   std::string argument_list(t_struct* tstruct, bool include_types = true);
   std::string type_to_enum(t_type* ttype);
-  std::string get_enum_class_name(t_type* type);
+  std::string get_enum_class_name(t_type* type) override;
   void generate_struct_desc(ostream& out, t_struct* tstruct);
   void generate_field_descs(ostream& out, t_struct* tstruct);
   std::string box_type(t_type* type, string value);
@@ -2980,9 +2980,7 @@
 
   bool is_first = true;
   bool was_previous_char_upper = false;
-  for (string::iterator iter = name.begin(); iter != name.end(); ++iter) {
-    string::value_type character = (*iter);
-
+  for (char character : name) {
     bool is_upper = isupper(character);
 
     if (is_upper && !is_first && !was_previous_char_upper) {
diff --git a/compiler/cpp/src/thrift/generate/t_js_generator.cc b/compiler/cpp/src/thrift/generate/t_js_generator.cc
index e7f625c..af402a4 100644
--- a/compiler/cpp/src/thrift/generate/t_js_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_js_generator.cc
@@ -121,19 +121,19 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   std::string render_recv_throw(std::string var);
   std::string render_recv_return(std::string var);
@@ -215,7 +215,7 @@
   std::string type_to_enum(t_type* ttype);
   std::string make_valid_nodeJs_identifier(std::string const& name);
 
-  std::string autogen_comment() {
+  std::string autogen_comment() override {
     return std::string("//\n") + "// Autogenerated by Thrift Compiler (" + THRIFT_VERSION + ")\n"
            + "//\n" + "// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n"
            + "//\n";
@@ -499,8 +499,8 @@
 
   if (gen_node_) {
     const vector<t_program*>& includes = program_->get_includes();
-    for (size_t i = 0; i < includes.size(); ++i) {
-      result += js_const_type_ + make_valid_nodeJs_identifier(includes[i]->get_name()) + "_ttypes = require('./" + includes[i]->get_name()
+    for (auto include : includes) {
+      result += js_const_type_ + make_valid_nodeJs_identifier(include->get_name()) + "_ttypes = require('./" + include->get_name()
                 + "_types');\n";
     }
     if (includes.size() > 0) {
@@ -521,8 +521,8 @@
     return result;
   }
   const vector<t_program*>& includes = program_->get_includes();
-  for (size_t i = 0; i < includes.size(); ++i) {
-    result += "import " + make_valid_nodeJs_identifier(includes[i]->get_name()) + "_ttypes = require('./" + includes[i]->get_name()
+  for (auto include : includes) {
+    result += "import " + make_valid_nodeJs_identifier(include->get_name()) + "_ttypes = require('./" + include->get_name()
               + "_types');\n";
   }
   if (includes.size() > 0) {
@@ -1440,8 +1440,8 @@
   t_struct* exceptions = tfunction->get_xceptions();
   if (exceptions) {
     const vector<t_field*>& members = exceptions->get_members();
-    for (vector<t_field*>::const_iterator it = members.begin(); it != members.end(); ++it) {
-      t_type* t = get_true_type((*it)->get_type());
+    for (auto member : members) {
+      t_type* t = get_true_type(member->get_type());
       if (t->is_xception()) {
         if (!has_exception) {
           has_exception = true;
@@ -1504,8 +1504,8 @@
   indent(f_service_) << "if ((err === null || typeof err === 'undefined')";
   if (has_exception) {
     const vector<t_field*>& members = exceptions->get_members();
-    for (vector<t_field*>::const_iterator it = members.begin(); it != members.end(); ++it) {
-      t_type* t = get_true_type((*it)->get_type());
+    for (auto member : members) {
+      t_type* t = get_true_type(member->get_type());
       if (t->is_xception()) {
         f_service_ << " || err instanceof " << js_type_namespace(t->get_program()) << t->get_name();
       }
diff --git a/compiler/cpp/src/thrift/generate/t_json_generator.cc b/compiler/cpp/src/thrift/generate/t_json_generator.cc
index cd53612..eb4ef79 100644
--- a/compiler/cpp/src/thrift/generate/t_json_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_json_generator.cc
@@ -68,23 +68,23 @@
     out_dir_base_ = "gen-json";
   }
 
-  virtual ~t_json_generator() {}
+  ~t_json_generator() override = default;
 
   /**
   * Init and close methods
   */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_program();
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_program() override;
   void generate_function(t_function* tfunc);
   void generate_field(t_field* field);
 
-  void generate_service(t_service* tservice);
-  void generate_struct(t_struct* tstruct);
+  void generate_service(t_service* tservice) override;
+  void generate_struct(t_struct* tstruct) override;
 
 private:
   bool should_merge_includes_;
@@ -147,8 +147,8 @@
 
 string t_json_generator::escape_json_string(const string& input) {
   std::ostringstream ss;
-  for (std::string::const_iterator iter = input.begin(); iter != input.end(); iter++) {
-    switch (*iter) {
+  for (char iter : input) {
+    switch (iter) {
     case '\\':
       ss << "\\\\";
       break;
@@ -174,7 +174,7 @@
       ss << "\\t";
       break;
     default:
-      ss << *iter;
+      ss << iter;
       break;
     }
   }
@@ -267,8 +267,8 @@
   if (ttype->annotations_.size() > 0) {
     write_key_and("annotations");
     start_object();
-    for (map<string, string>::iterator it = ttype->annotations_.begin(); it != ttype->annotations_.end(); ++it) {
-      write_key_and_string(it->first, it->second);
+    for (auto & annotation : ttype->annotations_) {
+      write_key_and_string(annotation.first, annotation.second);
     }
     end_object();
   }
@@ -457,8 +457,8 @@
   if (ttypedef->annotations_.size() > 0) {
     write_key_and("annotations");
     start_object();
-    for (map<string, string>::iterator it = ttypedef->annotations_.begin(); it != ttypedef->annotations_.end(); ++it) {
-      write_key_and_string(it->first, it->second);
+    for (auto & annotation : ttypedef->annotations_) {
+      write_key_and_string(annotation.first, annotation.second);
     }
     end_object();
   }
@@ -564,8 +564,8 @@
   if (tenum->annotations_.size() > 0) {
       write_key_and("annotations");
       start_object();
-      for (map<string, string>::iterator it = tenum->annotations_.begin(); it != tenum->annotations_.end(); ++it) {
-        write_key_and_string(it->first, it->second);
+      for (auto & annotation : tenum->annotations_) {
+        write_key_and_string(annotation.first, annotation.second);
       }
       end_object();
   }
@@ -603,8 +603,8 @@
   if (tstruct->annotations_.size() > 0) {
     write_key_and("annotations");
     start_object();
-    for (map<string, string>::iterator it = tstruct->annotations_.begin(); it != tstruct->annotations_.end(); ++it) {
-      write_key_and_string(it->first, it->second);
+    for (auto & annotation : tstruct->annotations_) {
+      write_key_and_string(annotation.first, annotation.second);
     }
     end_object();
   }
@@ -643,8 +643,8 @@
   if (tservice->annotations_.size() > 0) {
     write_key_and("annotations");
     start_object();
-    for (map<string, string>::iterator it = tservice->annotations_.begin(); it != tservice->annotations_.end(); ++it) {
-      write_key_and_string(it->first, it->second);
+    for (auto & annotation : tservice->annotations_) {
+      write_key_and_string(annotation.first, annotation.second);
     }
     end_object();
   }
@@ -680,8 +680,8 @@
   if (tfunc->annotations_.size() > 0) {
     write_key_and("annotations");
     start_object();
-    for (map<string, string>::iterator it = tfunc->annotations_.begin(); it != tfunc->annotations_.end(); ++it) {
-      write_key_and_string(it->first, it->second);
+    for (auto & annotation : tfunc->annotations_) {
+      write_key_and_string(annotation.first, annotation.second);
     }
     end_object();
   }
@@ -726,8 +726,8 @@
   if (field->annotations_.size() > 0) {
     write_key_and("annotations");
     start_object();
-    for (map<string, string>::iterator it = field->annotations_.begin(); it != field->annotations_.end(); ++it) {
-      write_key_and_string(it->first, it->second);
+    for (auto & annotation : field->annotations_) {
+      write_key_and_string(annotation.first, annotation.second);
     }
     end_object();
   }
diff --git a/compiler/cpp/src/thrift/generate/t_lua_generator.cc b/compiler/cpp/src/thrift/generate/t_lua_generator.cc
index adee896..e6432c8 100644
--- a/compiler/cpp/src/thrift/generate/t_lua_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_lua_generator.cc
@@ -56,18 +56,18 @@
   /**
    * Init and close methods
    */
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   std::string render_const_value(t_type* type, t_const_value* value);
 
@@ -149,7 +149,7 @@
   std::string type_to_enum(t_type* ttype);
   static std::string get_namespace(const t_program* program);
 
-  std::string autogen_comment() {
+  std::string autogen_comment() override {
     return std::string("--\n") + "-- Autogenerated by Thrift\n" + "--\n"
            + "-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n" + "-- @"
                                                                                        "generated\n"
diff --git a/compiler/cpp/src/thrift/generate/t_netcore_generator.cc b/compiler/cpp/src/thrift/generate/t_netcore_generator.cc
index 6f346a3..1a5c384 100644
--- a/compiler/cpp/src/thrift/generate/t_netcore_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_netcore_generator.cc
@@ -2734,7 +2734,7 @@
 void t_netcore_generator::prepare_member_name_mapping(void* scope, const vector<t_field*>& members, const string& structname)
 {
     // begin new scope
-    member_mapping_scopes.push_back(member_mapping_scope());
+    member_mapping_scopes.emplace_back();
     member_mapping_scope& active = member_mapping_scopes.back();
     active.scope_member = scope;
 
diff --git a/compiler/cpp/src/thrift/generate/t_netstd_generator.cc b/compiler/cpp/src/thrift/generate/t_netstd_generator.cc
index 8cb3027..593bb64 100644
--- a/compiler/cpp/src/thrift/generate/t_netstd_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_netstd_generator.cc
@@ -2719,7 +2719,7 @@
 void t_netstd_generator::prepare_member_name_mapping(void* scope, const vector<t_field*>& members, const string& structname)
 {
     // begin new scope
-    member_mapping_scopes.push_back(member_mapping_scope());
+    member_mapping_scopes.emplace_back();
     member_mapping_scope& active = member_mapping_scopes.back();
     active.scope_member = scope;
 
diff --git a/compiler/cpp/src/thrift/generate/t_ocaml_generator.cc b/compiler/cpp/src/thrift/generate/t_ocaml_generator.cc
index 0ec81ba..a3781e8 100644
--- a/compiler/cpp/src/thrift/generate/t_ocaml_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_ocaml_generator.cc
@@ -65,19 +65,19 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
-  void generate_program();
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_program() override;
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   std::string render_const_value(t_type* type, t_const_value* value);
   bool struct_member_persistent(t_field* tmember);
diff --git a/compiler/cpp/src/thrift/generate/t_perl_generator.cc b/compiler/cpp/src/thrift/generate/t_perl_generator.cc
index 8924a76..80729cb 100644
--- a/compiler/cpp/src/thrift/generate/t_perl_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_perl_generator.cc
@@ -66,19 +66,19 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   std::string render_const_value(t_type* type, t_const_value* value);
 
@@ -152,7 +152,7 @@
   std::string argument_list(t_struct* tstruct);
   std::string type_to_enum(t_type* ttype);
 
-  std::string autogen_comment() {
+  std::string autogen_comment() override {
     return std::string("#\n") + "# Autogenerated by Thrift Compiler (" + THRIFT_VERSION + ")\n"
            + "#\n" + "# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n" + "#\n";
   }
diff --git a/compiler/cpp/src/thrift/generate/t_php_generator.cc b/compiler/cpp/src/thrift/generate/t_php_generator.cc
index 50a4415..79bd5a2 100644
--- a/compiler/cpp/src/thrift/generate/t_php_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_php_generator.cc
@@ -99,7 +99,7 @@
     escape_['$'] = "\\$";
   }
 
-  virtual std::string indent_str() const {
+  std::string indent_str() const override {
     return "    ";
   }
 
@@ -109,19 +109,19 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_consts(vector<t_const*> consts);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_consts(vector<t_const*> consts) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   std::string render_const_value(t_type* type, t_const_value* value);
 
@@ -284,9 +284,9 @@
     }
 
     // Transform the java-style namespace into a path.
-    for (std::string::iterator it = ns.begin(); it != ns.end(); ++it) {
-      if (*it == '.') {
-        *it = '/';
+    for (char & n : ns) {
+      if (n == '.') {
+        n = '/';
       }
     }
 
@@ -304,8 +304,8 @@
 
     vector<string> x = split(str, '_');
 
-    for (size_t i = 0; i < x.size(); ++i) {
-      classe = classe + capitalize(x[i]);
+    for (const auto & i : x) {
+      classe = classe + capitalize(i);
     }
 
     return classe;
@@ -420,8 +420,8 @@
   vector<string> NSx = split(php_namespace_suffix(get_program()), '\\');
   package_dir_ = get_out_dir();
 
-  for (size_t i = 0; i < NSx.size(); ++i) {
-    package_dir_ = package_dir_ + "/" + NSx[i] + "/";
+  for (const auto & i : NSx) {
+    package_dir_ = package_dir_ + "/" + i + "/";
     MKDIR(package_dir_.c_str());
   }
 
diff --git a/compiler/cpp/src/thrift/generate/t_py_generator.cc b/compiler/cpp/src/thrift/generate/t_py_generator.cc
index e46207a..c16d6d3 100644
--- a/compiler/cpp/src/thrift/generate/t_py_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_py_generator.cc
@@ -136,7 +136,7 @@
     }
   }
 
-  virtual std::string indent_str() const {
+  std::string indent_str() const override {
     return "    ";
   }
 
@@ -144,20 +144,20 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_forward_declaration(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_forward_declaration(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   std::string render_const_value(t_type* type, t_const_value* value);
 
@@ -335,7 +335,7 @@
   std::string module_;
 
 protected:
-  virtual std::set<std::string> lang_keywords() const {
+  std::set<std::string> lang_keywords() const override {
     std::string keywords[] = { "False", "None", "True", "and", "as", "assert", "break", "class",
           "continue", "def", "del", "elif", "else", "except", "exec", "finally", "for", "from",
           "global", "if", "import", "in", "is", "lambda", "nonlocal", "not", "or", "pass", "print",
@@ -415,8 +415,8 @@
 string t_py_generator::render_includes() {
   const vector<t_program*>& includes = program_->get_includes();
   string result = "";
-  for (size_t i = 0; i < includes.size(); ++i) {
-    result += "import " + get_real_py_module(includes[i], gen_twisted_, package_prefix_) + ".ttypes\n";
+  for (auto include : includes) {
+    result += "import " + get_real_py_module(include, gen_twisted_, package_prefix_) + ".ttypes\n";
   }
   return result;
 }
@@ -2607,7 +2607,7 @@
   string signature = tfunction->get_name() + "(";
 
   if (!(gen_zope_interface_ && interface)) {
-    pre.push_back("self");
+    pre.emplace_back("self");
   }
 
   signature += argument_list(tfunction->get_arglist(), &pre, &post) + ")";
diff --git a/compiler/cpp/src/thrift/generate/t_rb_generator.cc b/compiler/cpp/src/thrift/generate/t_rb_generator.cc
index 13ea249..61c3481 100644
--- a/compiler/cpp/src/thrift/generate/t_rb_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_rb_generator.cc
@@ -102,21 +102,21 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_forward_declaration(t_struct* tstruct);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_forward_declaration(t_struct* tstruct) override;
   void generate_union(t_struct* tunion);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
   t_rb_ofstream& render_const_value(t_rb_ofstream& out, t_type* type, t_const_value* value);
 
@@ -307,15 +307,15 @@
 string t_rb_generator::render_includes() {
   const vector<t_program*>& includes = program_->get_includes();
   string result = "";
-  for (size_t i = 0; i < includes.size(); ++i) {
+  for (auto include : includes) {
     if (namespaced_) {
-      t_program* included = includes[i];
+      t_program* included = include;
       std::string included_require_prefix
           = rb_namespace_to_path_prefix(included->get_namespace("rb"));
       std::string included_name = included->get_name();
       result += "require '" + included_require_prefix + underscore(included_name) + "_types'\n";
     } else {
-      result += "require '" + underscore(includes[i]->get_name()) + "_types'\n";
+      result += "require '" + underscore(include->get_name()) + "_types'\n";
     }
   }
   if (includes.size() > 0) {
@@ -763,8 +763,8 @@
 }
 
 void t_rb_generator::begin_namespace(t_rb_ofstream& out, vector<std::string> modules) {
-  for (vector<std::string>::iterator m_iter = modules.begin(); m_iter != modules.end(); ++m_iter) {
-    out.indent() << "module " << *m_iter << endl;
+  for (auto & module : modules) {
+    out.indent() << "module " << module << endl;
     out.indent_up();
   }
 }
@@ -1140,8 +1140,8 @@
 string t_rb_generator::full_type_name(const t_type* ttype) {
   string prefix = "::";
   vector<std::string> modules = ruby_modules(ttype->get_program());
-  for (vector<std::string>::iterator m_iter = modules.begin(); m_iter != modules.end(); ++m_iter) {
-    prefix += *m_iter + "::";
+  for (auto & module : modules) {
+    prefix += module + "::";
   }
   return prefix + type_name(ttype);
 }
diff --git a/compiler/cpp/src/thrift/generate/t_rs_generator.cc b/compiler/cpp/src/thrift/generate/t_rs_generator.cc
index 9843d7a..fdf6861 100644
--- a/compiler/cpp/src/thrift/generate/t_rs_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_rs_generator.cc
@@ -74,19 +74,19 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
 private:
   // struct type
@@ -3285,8 +3285,8 @@
 string t_rs_generator::rust_enum_variant_name(const string &name) {
   bool all_uppercase = true;
 
-  for (size_t i = 0; i < name.size(); i++) {
-    if (isalnum(name[i]) && islower(name[i])) {
+  for (char i : name) {
+    if (isalnum(i) && islower(i)) {
       all_uppercase = false;
       break;
     }
diff --git a/compiler/cpp/src/thrift/generate/t_st_generator.cc b/compiler/cpp/src/thrift/generate/t_st_generator.cc
index 595a949..bc95feb 100644
--- a/compiler/cpp/src/thrift/generate/t_st_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_st_generator.cc
@@ -71,19 +71,19 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_const(t_const* tconst);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_const(t_const* tconst) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
   void generate_class_side_definition();
   void generate_force_consts();
 
@@ -233,9 +233,9 @@
   string cat = program_->get_namespace("smalltalk.category");
   // For compatibility with the Thrift grammar, the category must
   // be punctuated by dots.  Replaces them with dashes here.
-  for (string::iterator iter = cat.begin(); iter != cat.end(); ++iter) {
-    if (*iter == '.') {
-      *iter = '-';
+  for (char & iter : cat) {
+    if (iter == '.') {
+      iter = '-';
     }
   }
   return cat.size() ? cat : "Generated-" + class_name();
diff --git a/compiler/cpp/src/thrift/generate/t_swift_generator.cc b/compiler/cpp/src/thrift/generate/t_swift_generator.cc
index 31db04d..eb746c1 100644
--- a/compiler/cpp/src/thrift/generate/t_swift_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_swift_generator.cc
@@ -94,20 +94,20 @@
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
-  void generate_consts(vector<t_const*> consts);
+  void generate_consts(vector<t_const*> consts) override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
-  void generate_struct(t_struct* tstruct);
-  void generate_xception(t_struct* txception);
-  void generate_service(t_service* tservice);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
+  void generate_struct(t_struct* tstruct) override;
+  void generate_xception(t_struct* txception) override;
+  void generate_service(t_service* tservice) override;
 
 
   void render_const_value(ostream& out,
@@ -336,7 +336,7 @@
 string t_swift_generator::swift_imports() {
 
   vector<string> includes_list;
-  includes_list.push_back("Foundation");
+  includes_list.emplace_back("Foundation");
 
   ostringstream includes;
 
@@ -347,8 +347,8 @@
 
   if (namespaced_) {
     const vector<t_program*>& program_includes = program_->get_includes();
-    for (size_t i = 0; i < program_includes.size(); ++i) {
-      includes << ("import " + get_real_swift_module(program_includes[i])) << endl;
+    for (auto program_include : program_includes) {
+      includes << ("import " + get_real_swift_module(program_include)) << endl;
     }
   }
   includes << endl;
@@ -364,10 +364,10 @@
 string t_swift_generator::swift_thrift_imports() {
 
   vector<string> includes_list;
-  includes_list.push_back("Thrift");
+  includes_list.emplace_back("Thrift");
 
   if (gen_cocoa_ && promise_kit_) {
-    includes_list.push_back("PromiseKit");
+    includes_list.emplace_back("PromiseKit");
   }
 
   ostringstream includes;
diff --git a/compiler/cpp/src/thrift/generate/t_xml_generator.cc b/compiler/cpp/src/thrift/generate/t_xml_generator.cc
index 35fed14..b669293 100644
--- a/compiler/cpp/src/thrift/generate/t_xml_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_xml_generator.cc
@@ -79,20 +79,20 @@
     out_dir_base_ = "gen-xml";
   }
 
-  virtual ~t_xml_generator() {}
+  ~t_xml_generator() override = default;
 
-  void init_generator();
-  void close_generator();
-  void generate_program();
+  void init_generator() override;
+  void close_generator() override;
+  void generate_program() override;
 
   void iterate_program(t_program* program);
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum);
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override;
   void generate_function(t_function* tfunc);
   void generate_field(t_field* field);
 
-  void generate_service(t_service* tservice);
-  void generate_struct(t_struct* tstruct);
+  void generate_service(t_service* tservice) override;
+  void generate_struct(t_struct* tstruct) override;
 
   void generate_annotations(std::map<std::string, std::string> annotations);
 
@@ -245,8 +245,8 @@
 
 string t_xml_generator::escape_xml_string(const string& input) {
   std::ostringstream ss;
-  for (std::string::const_iterator iter = input.begin(); iter != input.end(); iter++) {
-    switch (*iter) {
+  for (char iter : input) {
+    switch (iter) {
     case '&':
       ss << "&amp;";
       break;
@@ -263,7 +263,7 @@
       ss << "&gt;";
       break;
     default:
-      ss << *iter;
+      ss << iter;
       break;
     }
   }
diff --git a/compiler/cpp/src/thrift/generate/t_xsd_generator.cc b/compiler/cpp/src/thrift/generate/t_xsd_generator.cc
index e487ffc..379e5a4 100644
--- a/compiler/cpp/src/thrift/generate/t_xsd_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_xsd_generator.cc
@@ -59,24 +59,24 @@
     out_dir_base_ = "gen-xsd";
   }
 
-  virtual ~t_xsd_generator() {}
+  ~t_xsd_generator() override = default;
 
   /**
    * Init and close methods
    */
 
-  void init_generator();
-  void close_generator();
+  void init_generator() override;
+  void close_generator() override;
 
   /**
    * Program-level generation functions
    */
 
-  void generate_typedef(t_typedef* ttypedef);
-  void generate_enum(t_enum* tenum) { (void)tenum; }
+  void generate_typedef(t_typedef* ttypedef) override;
+  void generate_enum(t_enum* tenum) override { (void)tenum; }
 
-  void generate_service(t_service* tservice);
-  void generate_struct(t_struct* tstruct);
+  void generate_service(t_service* tservice) override;
+  void generate_struct(t_struct* tstruct) override;
 
 private:
   void generate_element(std::ostream& out,
diff --git a/compiler/cpp/src/thrift/main.cc b/compiler/cpp/src/thrift/main.cc
index adcab83..5b69dc5 100644
--- a/compiler/cpp/src/thrift/main.cc
+++ b/compiler/cpp/src/thrift/main.cc
@@ -983,11 +983,11 @@
   // Oooohh, recursive code generation, hot!!
   if (gen_recurse) {
     const vector<t_program*>& includes = program->get_includes();
-    for (size_t i = 0; i < includes.size(); ++i) {
+    for (auto include : includes) {
       // Propagate output path from parent to child programs
-      includes[i]->set_out_path(program->get_out_path(), program->is_out_path_absolute());
+      include->set_out_path(program->get_out_path(), program->is_out_path_absolute());
 
-      generate(includes[i], generator_strings);
+      generate(include, generator_strings);
     }
   }
 
@@ -1110,7 +1110,7 @@
           fprintf(stderr, "Missing generator specification\n");
           usage();
         }
-        generator_strings.push_back(arg);
+        generator_strings.emplace_back(arg);
       } else if (strcmp(arg, "-I") == 0) {
         // An argument of "-I\ asdf" is invalid and has unknown results
         arg = argv[++i];
@@ -1119,7 +1119,7 @@
           fprintf(stderr, "Missing Include directory\n");
           usage();
         }
-        g_incl_searchpath.push_back(arg);
+        g_incl_searchpath.emplace_back(arg);
       } else if ((strcmp(arg, "-o") == 0) || (strcmp(arg, "-out") == 0)) {
         out_path_is_absolute = (strcmp(arg, "-out") == 0) ? true : false;
         arg = argv[++i];
diff --git a/compiler/cpp/src/thrift/parse/t_program.h b/compiler/cpp/src/thrift/parse/t_program.h
index 8b60611..13cb26e 100644
--- a/compiler/cpp/src/thrift/parse/t_program.h
+++ b/compiler/cpp/src/thrift/parse/t_program.h
@@ -286,7 +286,6 @@
     if (language != "*") {
       size_t sub_index = language.find('.');
       std::string base_language = language.substr(0, sub_index);
-      std::string sub_namespace;
 
       if (base_language == "smalltalk") {
         pwarning(1, "Namespace 'smalltalk' is deprecated. Use 'st' instead");
diff --git a/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp b/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp
index 952394b..0dac524 100644
--- a/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp
+++ b/lib/cpp/src/thrift/async/TConcurrentClientSyncInfo.cpp
@@ -17,10 +17,11 @@
  * under the License.
  */
 
-#include <thrift/async/TConcurrentClientSyncInfo.h>
-#include <thrift/TApplicationException.h>
-#include <thrift/transport/TTransportException.h>
 #include <limits>
+#include <memory>
+#include <thrift/TApplicationException.h>
+#include <thrift/async/TConcurrentClientSyncInfo.h>
+#include <thrift/transport/TTransportException.h>
 
 namespace apache { namespace thrift { namespace async {
 
@@ -140,15 +141,15 @@
 {
   wakeupSomeone_ = true;
   stop_ = true;
-  for(auto i = seqidToMonitorMap_.begin(); i != seqidToMonitorMap_.end(); ++i)
-    i->second->notify();
+  for(auto & i : seqidToMonitorMap_)
+    i.second->notify();
 }
 
 TConcurrentClientSyncInfo::MonitorPtr
 TConcurrentClientSyncInfo::newMonitor_(const Guard &)
 {
   if(freeMonitors_.empty())
-    return MonitorPtr(new Monitor(&readMutex_));
+    return std::make_shared<Monitor>(&readMutex_);
   MonitorPtr retval;
   //swapping to avoid an atomic operation
   retval.swap(freeMonitors_.back());
diff --git a/lib/cpp/src/thrift/concurrency/ThreadFactory.cpp b/lib/cpp/src/thrift/concurrency/ThreadFactory.cpp
index 941b993..becb3b2 100644
--- a/lib/cpp/src/thrift/concurrency/ThreadFactory.cpp
+++ b/lib/cpp/src/thrift/concurrency/ThreadFactory.cpp
@@ -27,7 +27,7 @@
 namespace concurrency {
 
 std::shared_ptr<Thread> ThreadFactory::newThread(std::shared_ptr<Runnable> runnable) const {
-  std::shared_ptr<Thread> result = std::shared_ptr<Thread>(new Thread(isDetached(), runnable));
+  std::shared_ptr<Thread> result = std::make_shared<Thread>(isDetached(), runnable);
   runnable->thread(result);
   return result;
 }
diff --git a/lib/cpp/src/thrift/concurrency/ThreadManager.cpp b/lib/cpp/src/thrift/concurrency/ThreadManager.cpp
index c889660..25b838a 100644
--- a/lib/cpp/src/thrift/concurrency/ThreadManager.cpp
+++ b/lib/cpp/src/thrift/concurrency/ThreadManager.cpp
@@ -344,7 +344,7 @@
   std::set<shared_ptr<Thread> > newThreads;
   for (size_t ix = 0; ix < value; ix++) {
     shared_ptr<ThreadManager::Worker> worker
-        = shared_ptr<ThreadManager::Worker>(new ThreadManager::Worker(this));
+        = std::make_shared<ThreadManager::Worker>(this);
     newThreads.insert(threadFactory_->newThread(worker));
   }
 
@@ -352,13 +352,12 @@
   workerMaxCount_ += value;
   workers_.insert(newThreads.begin(), newThreads.end());
 
-  for (auto ix = newThreads.begin(); ix != newThreads.end();
-       ++ix) {
+  for (const auto & newThread : newThreads) {
     shared_ptr<ThreadManager::Worker> worker
-        = dynamic_pointer_cast<ThreadManager::Worker, Runnable>((*ix)->runnable());
+        = dynamic_pointer_cast<ThreadManager::Worker, Runnable>(newThread->runnable());
     worker->state_ = ThreadManager::Worker::STARTING;
-    (*ix)->start();
-    idMap_.insert(std::pair<const Thread::id_t, shared_ptr<Thread> >((*ix)->getId(), *ix));
+    newThread->start();
+    idMap_.insert(std::pair<const Thread::id_t, shared_ptr<Thread> >(newThread->getId(), newThread));
   }
 
   while (workerCount_ != workerMaxCount_) {
@@ -430,17 +429,15 @@
     workerMonitor_.wait();
   }
 
-  for (auto ix = deadWorkers_.begin();
-       ix != deadWorkers_.end();
-       ++ix) {
+  for (const auto & deadWorker : deadWorkers_) {
 
     // when used with a joinable thread factory, we join the threads as we remove them
     if (!threadFactory_->isDetached()) {
-      (*ix)->join();
+      deadWorker->join();
     }
 
-    idMap_.erase((*ix)->getId());
-    workers_.erase(*ix);
+    idMap_.erase(deadWorker->getId());
+    workers_.erase(deadWorker);
   }
 
   deadWorkers_.clear();
@@ -480,7 +477,7 @@
     }
   }
 
-  tasks_.push_back(shared_ptr<ThreadManager::Task>(new ThreadManager::Task(value, expiration)));
+  tasks_.push_back(std::make_shared<ThreadManager::Task>(value, expiration));
 
   // If idle thread is available notify it, otherwise all worker threads are
   // running and will get around to this task in time.
diff --git a/lib/cpp/src/thrift/concurrency/TimerManager.cpp b/lib/cpp/src/thrift/concurrency/TimerManager.cpp
index df59900..003f564 100644
--- a/lib/cpp/src/thrift/concurrency/TimerManager.cpp
+++ b/lib/cpp/src/thrift/concurrency/TimerManager.cpp
@@ -22,6 +22,7 @@
 
 #include <assert.h>
 #include <iostream>
+#include <memory>
 #include <set>
 
 namespace apache {
@@ -121,10 +122,8 @@
         }
       }
 
-      for (auto ix = expiredTasks.begin();
-           ix != expiredTasks.end();
-           ++ix) {
-        (*ix)->run();
+      for (const auto & expiredTask : expiredTasks) {
+        expiredTask->run();
       }
 
     } while (manager_->state_ == TimerManager::STARTED);
@@ -152,7 +151,7 @@
 TimerManager::TimerManager()
   : taskCount_(0),
     state_(TimerManager::UNINITIALIZED),
-    dispatcher_(shared_ptr<Dispatcher>(new Dispatcher(this))) {
+    dispatcher_(std::make_shared<Dispatcher>(this)) {
 }
 
 #if defined(_MSC_VER)
diff --git a/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp b/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
index 35592f0..28d0da2 100644
--- a/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
+++ b/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
@@ -20,8 +20,6 @@
 #include <thrift/protocol/TJSONProtocol.h>
 
 #include <boost/locale.hpp>
-#include <boost/math/special_functions/fpclassify.hpp>
-#include <boost/math/special_functions/sign.hpp>
 
 #include <cmath>
 #include <limits>
@@ -537,9 +535,9 @@
   std::string val;
 
   bool special = false;
-  switch (boost::math::fpclassify(num)) {
+  switch (std::fpclassify(num)) {
   case FP_INFINITE:
-    if (boost::math::signbit(num)) {
+    if (std::signbit(num)) {
       val = kThriftNegativeInfinity;
     } else {
       val = kThriftInfinity;
diff --git a/lib/cpp/src/thrift/protocol/TJSONProtocol.h b/lib/cpp/src/thrift/protocol/TJSONProtocol.h
index 020e61c..420995e 100644
--- a/lib/cpp/src/thrift/protocol/TJSONProtocol.h
+++ b/lib/cpp/src/thrift/protocol/TJSONProtocol.h
@@ -248,7 +248,7 @@
   class LookaheadReader {
 
   public:
-    LookaheadReader(TTransport& trans) : trans_(&trans), hasData_(false) {}
+    LookaheadReader(TTransport& trans) : trans_(&trans), hasData_(false), data_(0) {}
 
     uint8_t read() {
       if (hasData_) {
diff --git a/lib/cpp/src/thrift/qt/TQIODeviceTransport.cpp b/lib/cpp/src/thrift/qt/TQIODeviceTransport.cpp
index 78c3b39..1537fc6 100644
--- a/lib/cpp/src/thrift/qt/TQIODeviceTransport.cpp
+++ b/lib/cpp/src/thrift/qt/TQIODeviceTransport.cpp
@@ -46,7 +46,7 @@
   }
 }
 
-bool TQIODeviceTransport::isOpen() {
+bool TQIODeviceTransport::isOpen() const {
   return dev_->isOpen();
 }
 
diff --git a/lib/cpp/src/thrift/qt/TQIODeviceTransport.h b/lib/cpp/src/thrift/qt/TQIODeviceTransport.h
index e0cdd18..a3b511d 100644
--- a/lib/cpp/src/thrift/qt/TQIODeviceTransport.h
+++ b/lib/cpp/src/thrift/qt/TQIODeviceTransport.h
@@ -40,7 +40,7 @@
   ~TQIODeviceTransport() override;
 
   void open() override;
-  bool isOpen();
+  bool isOpen() const override;
   bool peek() override;
   void close() override;
 
diff --git a/lib/cpp/src/thrift/qt/TQTcpServer.cpp b/lib/cpp/src/thrift/qt/TQTcpServer.cpp
index bd39893..0404482 100644
--- a/lib/cpp/src/thrift/qt/TQTcpServer.cpp
+++ b/lib/cpp/src/thrift/qt/TQTcpServer.cpp
@@ -90,7 +90,7 @@
     }
 
     ctxMap_[connection.get()]
-        = shared_ptr<ConnectionContext>(new ConnectionContext(connection, transport, iprot, oprot));
+        = std::make_shared<ConnectionContext>(connection, transport, iprot, oprot);
 
     connect(connection.get(), SIGNAL(readyRead()), SLOT(beginDecode()));
 
diff --git a/lib/cpp/src/thrift/server/TNonblockingServer.cpp b/lib/cpp/src/thrift/server/TNonblockingServer.cpp
index 4e62324..eea0427 100644
--- a/lib/cpp/src/thrift/server/TNonblockingServer.cpp
+++ b/lib/cpp/src/thrift/server/TNonblockingServer.cpp
@@ -1074,8 +1074,8 @@
 
 void TNonblockingServer::stop() {
   // Breaks the event loop in all threads so that they end ASAP.
-  for (uint32_t i = 0; i < ioThreads_.size(); ++i) {
-    ioThreads_[i]->stop();
+  for (auto & ioThread : ioThreads_) {
+    ioThread->stop();
   }
 }
 
@@ -1162,10 +1162,13 @@
                                            bool useHighPriority)
   : server_(server),
     number_(number),
+    threadId_{},
     listenSocket_(listenSocket),
     useHighPriority_(useHighPriority),
     eventBase_(nullptr),
-    ownEventBase_(false) {
+    ownEventBase_(false),
+    serverEvent_{},
+    notificationEvent_{} {
   notificationPipeFDs_[0] = -1;
   notificationPipeFDs_[1] = -1;
 }
@@ -1186,13 +1189,13 @@
     listenSocket_ = THRIFT_INVALID_SOCKET;
   }
 
-  for (int i = 0; i < 2; ++i) {
-    if (notificationPipeFDs_[i] >= 0) {
-      if (0 != ::THRIFT_CLOSESOCKET(notificationPipeFDs_[i])) {
+  for (auto notificationPipeFD : notificationPipeFDs_) {
+    if (notificationPipeFD >= 0) {
+      if (0 != ::THRIFT_CLOSESOCKET(notificationPipeFD)) {
         GlobalOutput.perror("TNonblockingIOThread notificationPipe close(): ",
                             THRIFT_GET_SOCKET_ERROR);
       }
-      notificationPipeFDs_[i] = THRIFT_INVALID_SOCKET;
+      notificationPipeFD = THRIFT_INVALID_SOCKET;
     }
   }
 }
@@ -1208,13 +1211,13 @@
     ::THRIFT_CLOSESOCKET(notificationPipeFDs_[1]);
     throw TException("TNonblockingServer::createNotificationPipe() THRIFT_O_NONBLOCK");
   }
-  for (int i = 0; i < 2; ++i) {
+  for (auto notificationPipeFD : notificationPipeFDs_) {
 #if LIBEVENT_VERSION_NUMBER < 0x02000000
     int flags;
-    if ((flags = THRIFT_FCNTL(notificationPipeFDs_[i], F_GETFD, 0)) < 0
-        || THRIFT_FCNTL(notificationPipeFDs_[i], F_SETFD, flags | FD_CLOEXEC) < 0) {
+    if ((flags = THRIFT_FCNTL(notificationPipeFD, F_GETFD, 0)) < 0
+        || THRIFT_FCNTL(notificationPipeFD, F_SETFD, flags | FD_CLOEXEC) < 0) {
 #else
-    if (evutil_make_socket_closeonexec(notificationPipeFDs_[i]) < 0) {
+    if (evutil_make_socket_closeonexec(notificationPipeFD) < 0) {
 #endif
       ::THRIFT_CLOSESOCKET(notificationPipeFDs_[0]);
       ::THRIFT_CLOSESOCKET(notificationPipeFDs_[1]);
diff --git a/lib/cpp/src/thrift/transport/TBufferTransports.h b/lib/cpp/src/thrift/transport/TBufferTransports.h
index a008fa1..df06586 100644
--- a/lib/cpp/src/thrift/transport/TBufferTransports.h
+++ b/lib/cpp/src/thrift/transport/TBufferTransports.h
@@ -217,7 +217,7 @@
 
   void open() override { transport_->open(); }
 
-  bool isOpen() { return transport_->isOpen(); }
+  bool isOpen() const override { return transport_->isOpen(); }
 
   bool peek() override {
     if (rBase_ == rBound_) {
@@ -345,7 +345,7 @@
 
   void open() override { transport_->open(); }
 
-  bool isOpen() { return transport_->isOpen(); }
+  bool isOpen() const override { return transport_->isOpen(); }
 
   bool peek() override { return (rBase_ < rBound_) || transport_->peek(); }
 
@@ -550,7 +550,7 @@
     }
   }
 
-  bool isOpen() { return true; }
+  bool isOpen() const override { return true; }
 
   bool peek() override { return (rBase_ < wBase_); }
 
diff --git a/lib/cpp/src/thrift/transport/TFDTransport.h b/lib/cpp/src/thrift/transport/TFDTransport.h
index ede5ccb..a3cf519 100644
--- a/lib/cpp/src/thrift/transport/TFDTransport.h
+++ b/lib/cpp/src/thrift/transport/TFDTransport.h
@@ -53,7 +53,7 @@
     }
   }
 
-  bool isOpen() { return fd_ >= 0; }
+  bool isOpen() const override { return fd_ >= 0; }
 
   void open() override {}
 
diff --git a/lib/cpp/src/thrift/transport/TFileTransport.cpp b/lib/cpp/src/thrift/transport/TFileTransport.cpp
index 1eefb89..53e5136 100644
--- a/lib/cpp/src/thrift/transport/TFileTransport.cpp
+++ b/lib/cpp/src/thrift/transport/TFileTransport.cpp
@@ -977,7 +977,7 @@
     inputTransport_(inputTransport) {
 
   // default the output transport to a null transport (common case)
-  outputTransport_ = shared_ptr<TNullTransport>(new TNullTransport());
+  outputTransport_ = std::make_shared<TNullTransport>();
 }
 
 TFileProcessor::TFileProcessor(shared_ptr<TProcessor> processor,
@@ -990,7 +990,7 @@
     inputTransport_(inputTransport) {
 
   // default the output transport to a null transport (common case)
-  outputTransport_ = shared_ptr<TNullTransport>(new TNullTransport());
+  outputTransport_ = std::make_shared<TNullTransport>();
 }
 
 TFileProcessor::TFileProcessor(shared_ptr<TProcessor> processor,
diff --git a/lib/cpp/src/thrift/transport/THttpTransport.h b/lib/cpp/src/thrift/transport/THttpTransport.h
index 1cf36b2..75f0d8c 100644
--- a/lib/cpp/src/thrift/transport/THttpTransport.h
+++ b/lib/cpp/src/thrift/transport/THttpTransport.h
@@ -42,7 +42,7 @@
 
   void open() override { transport_->open(); }
 
-  bool isOpen() { return transport_->isOpen(); }
+  bool isOpen() const override { return transport_->isOpen(); }
 
   bool peek() override { return transport_->peek(); }
 
diff --git a/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp b/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp
index 51990b0..9902b90 100644
--- a/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp
@@ -20,6 +20,7 @@
 #include <thrift/thrift-config.h>
 
 #include <cstring>
+#include <memory>
 #include <stdexcept>
 #include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
@@ -532,7 +533,7 @@
 }
 
 shared_ptr<TSocket> TNonblockingServerSocket::createSocket(THRIFT_SOCKET clientSocket) {
-  return shared_ptr<TSocket>(new TSocket(clientSocket));
+  return std::make_shared<TSocket>(clientSocket);
 }
 
 void TNonblockingServerSocket::close() {
diff --git a/lib/cpp/src/thrift/transport/TPipeServer.cpp b/lib/cpp/src/thrift/transport/TPipeServer.cpp
index 55c3580..47d8822 100644
--- a/lib/cpp/src/thrift/transport/TPipeServer.cpp
+++ b/lib/cpp/src/thrift/transport/TPipeServer.cpp
@@ -333,8 +333,22 @@
   SetEntriesInAcl(1, &ea, NULL, &acl);
 
   PSECURITY_DESCRIPTOR sd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
-  InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION);
-  SetSecurityDescriptorDacl(sd, TRUE, acl, FALSE);
+  if (!InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION)) {
+    auto lastError = GetLastError();
+    LocalFree(sd);
+    LocalFree(acl);
+    GlobalOutput.perror("TPipeServer::InitializeSecurityDescriptor() GLE=", lastError);
+    throw TTransportException(TTransportException::NOT_OPEN, "InitializeSecurityDescriptor() failed",
+                              lastError);
+  }
+  if (!SetSecurityDescriptorDacl(sd, TRUE, acl, FALSE)) {
+    auto lastError = GetLastError();
+    LocalFree(sd);
+    LocalFree(acl);
+    GlobalOutput.perror("TPipeServer::SetSecurityDescriptorDacl() GLE=", lastError);
+    throw TTransportException(TTransportException::NOT_OPEN,
+                              "SetSecurityDescriptorDacl() failed", lastError);
+  }
 
   SECURITY_ATTRIBUTES sa;
   sa.nLength = sizeof(SECURITY_ATTRIBUTES);
@@ -353,7 +367,7 @@
                                      0,                    // client time-out
                                      &sa));                // security attributes
 
-  DWORD lastError = GetLastError();
+  auto lastError = GetLastError();
   LocalFree(sd);
   LocalFree(acl);
   FreeSid(everyone_sid);
@@ -364,7 +378,6 @@
     throw TTransportException(TTransportException::NOT_OPEN,
                               "TCreateNamedPipe() failed",
                 lastError);
-    return false;
   }
 
   Pipe_.reset(hPipe.release());
@@ -375,8 +388,17 @@
   SECURITY_ATTRIBUTES sa;
   SECURITY_DESCRIPTOR sd; // security information for pipes
 
-  InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
-  SetSecurityDescriptorDacl(&sd, true, NULL, false);
+  if (!InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION))
+  {
+    GlobalOutput.perror("TPipeServer InitializeSecurityDescriptor (anon) failed, GLE=", GetLastError());
+    return false;
+  }
+  if (!SetSecurityDescriptorDacl(&sd, true, NULL, false))
+  {
+    GlobalOutput.perror("TPipeServer SetSecurityDescriptorDacl (anon) failed, GLE=",
+                        GetLastError());
+    return false;
+  }
   sa.lpSecurityDescriptor = &sd;
   sa.nLength = sizeof(SECURITY_ATTRIBUTES);
   sa.bInheritHandle = true; // allow passing handle to child
diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.cpp b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
index 636bb2d..b413002 100644
--- a/lib/cpp/src/thrift/transport/TSSLSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
@@ -19,9 +19,10 @@
 
 #include <thrift/thrift-config.h>
 
-#include <errno.h>
-#include <string>
 #include <cstring>
+#include <errno.h>
+#include <memory>
+#include <string>
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #endif
@@ -266,7 +267,7 @@
   eventSafe_ = false;
 }
 
-bool TSSLSocket::isOpen() {
+bool TSSLSocket::isOpen() const {
   if (ssl_ == nullptr || !TSocket::isOpen()) {
     return false;
   }
@@ -291,11 +292,10 @@
   if (!checkHandshake())
     throw TSSLException("SSL_peek: Handshake is not completed");
   int rc;
-  uint8_t byte;
   do {
+    uint8_t byte;
     rc = SSL_peek(ssl_, &byte, 1);
     if (rc < 0) {
-
       int errno_copy = THRIFT_GET_SOCKET_ERROR;
       int error = SSL_get_error(ssl_, rc);
       switch (error) {
@@ -318,6 +318,8 @@
     } else if (rc == 0) {
       ERR_clear_error();
       break;
+    } else {
+      break;
     }
   } while (true);
   return (rc > 0);
@@ -857,7 +859,7 @@
     randomize();
   }
   count_++;
-  ctx_ = std::shared_ptr<SSLContext>(new SSLContext(protocol));
+  ctx_ = std::make_shared<SSLContext>(protocol);
 }
 
 TSSLSocketFactory::~TSSLSocketFactory() {
diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.h b/lib/cpp/src/thrift/transport/TSSLSocket.h
index 4d46998..87a9601 100644
--- a/lib/cpp/src/thrift/transport/TSSLSocket.h
+++ b/lib/cpp/src/thrift/transport/TSSLSocket.h
@@ -73,7 +73,7 @@
   /**
    * TTransport interface.
    */
-  bool isOpen();
+  bool isOpen() const override;
   bool peek() override;
   void open() override;
   void close() override;
diff --git a/lib/cpp/src/thrift/transport/TServerSocket.cpp b/lib/cpp/src/thrift/transport/TServerSocket.cpp
index 1732c82..ece0544 100644
--- a/lib/cpp/src/thrift/transport/TServerSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TServerSocket.cpp
@@ -20,6 +20,7 @@
 #include <thrift/thrift-config.h>
 
 #include <cstring>
+#include <memory>
 #include <stdexcept>
 #include <sys/types.h>
 #ifdef HAVE_SYS_SOCKET_H
@@ -641,9 +642,9 @@
 
 shared_ptr<TSocket> TServerSocket::createSocket(THRIFT_SOCKET clientSocket) {
   if (interruptableChildren_) {
-    return shared_ptr<TSocket>(new TSocket(clientSocket, pChildInterruptSockReader_));
+    return std::make_shared<TSocket>(clientSocket, pChildInterruptSockReader_);
   } else {
-    return shared_ptr<TSocket>(new TSocket(clientSocket));
+    return std::make_shared<TSocket>(clientSocket);
   }
 }
 
diff --git a/lib/cpp/src/thrift/transport/TShortReadTransport.h b/lib/cpp/src/thrift/transport/TShortReadTransport.h
index 2151606..185c78d 100644
--- a/lib/cpp/src/thrift/transport/TShortReadTransport.h
+++ b/lib/cpp/src/thrift/transport/TShortReadTransport.h
@@ -41,7 +41,7 @@
   TShortReadTransport(std::shared_ptr<TTransport> transport, double full_prob)
     : transport_(transport), fullProb_(full_prob) {}
 
-  bool isOpen() { return transport_->isOpen(); }
+  bool isOpen() const override { return transport_->isOpen(); }
 
   bool peek() override { return transport_->peek(); }
 
diff --git a/lib/cpp/src/thrift/transport/TSocketPool.cpp b/lib/cpp/src/thrift/transport/TSocketPool.cpp
index 89eee6e..b6e79d3 100644
--- a/lib/cpp/src/thrift/transport/TSocketPool.cpp
+++ b/lib/cpp/src/thrift/transport/TSocketPool.cpp
@@ -21,6 +21,7 @@
 
 #include <algorithm>
 #include <iostream>
+#include <memory>
 #if __cplusplus >= 201703L
 #include <random>
 #endif
@@ -94,8 +95,8 @@
     maxConsecutiveFailures_(1),
     randomize_(true),
     alwaysTryLast_(true) {
-  for (unsigned i = 0; i < servers.size(); ++i) {
-    addServer(servers[i].first, servers[i].second);
+  for (const auto & server : servers) {
+    addServer(server.first, server.second);
   }
 }
 
@@ -129,7 +130,7 @@
 }
 
 void TSocketPool::addServer(const string& host, int port) {
-  servers_.push_back(shared_ptr<TSocketPoolServer>(new TSocketPoolServer(host, port)));
+  servers_.push_back(std::make_shared<TSocketPoolServer>(host, port));
 }
 
 void TSocketPool::addServer(shared_ptr<TSocketPoolServer>& server) {
diff --git a/lib/cpp/src/thrift/transport/TTransportUtils.h b/lib/cpp/src/thrift/transport/TTransportUtils.h
index 6cff76a..28c93d2 100644
--- a/lib/cpp/src/thrift/transport/TTransportUtils.h
+++ b/lib/cpp/src/thrift/transport/TTransportUtils.h
@@ -46,7 +46,7 @@
 
   ~TNullTransport() override = default;
 
-  bool isOpen() { return true; }
+  bool isOpen() const override { return true; }
 
   void open() override {}
 
diff --git a/lib/cpp/src/thrift/transport/TZlibTransport.cpp b/lib/cpp/src/thrift/transport/TZlibTransport.cpp
index ddceb99..437190b 100644
--- a/lib/cpp/src/thrift/transport/TZlibTransport.cpp
+++ b/lib/cpp/src/thrift/transport/TZlibTransport.cpp
@@ -110,7 +110,7 @@
   delete wstream_;
 }
 
-bool TZlibTransport::isOpen() {
+bool TZlibTransport::isOpen() const {
   return (readAvail() > 0) || (rstream_->avail_in > 0) || transport_->isOpen();
 }
 
@@ -131,7 +131,7 @@
 // In standalone objects, we set input_ended_ to true when inflate returns
 // Z_STREAM_END.  This allows to make sure that a checksum was verified.
 
-inline int TZlibTransport::readAvail() {
+inline int TZlibTransport::readAvail() const {
   return urbuf_size_ - rstream_->avail_out - urpos_;
 }
 
diff --git a/lib/cpp/src/thrift/transport/TZlibTransport.h b/lib/cpp/src/thrift/transport/TZlibTransport.h
index be2d198..29afae0 100644
--- a/lib/cpp/src/thrift/transport/TZlibTransport.h
+++ b/lib/cpp/src/thrift/transport/TZlibTransport.h
@@ -138,7 +138,7 @@
    */
   ~TZlibTransport() override;
 
-  bool isOpen();
+  bool isOpen() const override;
   bool peek() override;
 
   void open() override { transport_->open(); }
@@ -185,7 +185,7 @@
 protected:
   inline void checkZlibRv(int status, const char* msg);
   inline void checkZlibRvNothrow(int status, const char* msg);
-  inline int readAvail();
+  inline int readAvail() const;
   void flushToTransport(int flush);
   void flushToZlib(const uint8_t* buf, int len, int flush);
   bool readFromZlib();
diff --git a/lib/cpp/test/TBufferBaseTest.cpp b/lib/cpp/test/TBufferBaseTest.cpp
index 430302c..7203f82 100644
--- a/lib/cpp/test/TBufferBaseTest.cpp
+++ b/lib/cpp/test/TBufferBaseTest.cpp
@@ -165,8 +165,8 @@
 
   // Repeatability.  Kind of.
   std::srand(42);
-  for (size_t i = 0; i < (sizeof(data)/sizeof(data[0])); ++i) {
-    data[i] = (uint8_t)rand();
+  for (unsigned char & i : data) {
+    i = (uint8_t)rand();
   }
 
   data_str.assign((char*)data, sizeof(data));
@@ -178,14 +178,14 @@
 BOOST_AUTO_TEST_CASE( test_MemoryBuffer_Write_GetBuffer ) {
   init_data();
 
-  for (int d1 = 0; d1 < 3; d1++) {
+  for (auto & d1 : dist) {
     TMemoryBuffer buffer(16);
     int offset = 0;
     int index = 0;
 
     while (offset < 1<<15) {
-      buffer.write(&data[offset], dist[d1][index]);
-      offset += dist[d1][index];
+      buffer.write(&data[offset], d1[index]);
+      offset += d1[index];
       index++;
     }
 
@@ -197,8 +197,8 @@
 BOOST_AUTO_TEST_CASE( test_MemoryBuffer_Write_Read ) {
   init_data();
 
-  for (int d1 = 0; d1 < 3; d1++) {
-    for (int d2 = 0; d2 < 3; d2++) {
+  for (auto & d1 : dist) {
+    for (auto & d2 : dist) {
       TMemoryBuffer buffer(16);
       uint8_t data_out[1<<15];
       int offset;
@@ -207,17 +207,17 @@
       offset = 0;
       index = 0;
       while (offset < 1<<15) {
-        buffer.write(&data[offset], dist[d1][index]);
-        offset += dist[d1][index];
+        buffer.write(&data[offset], d1[index]);
+        offset += d1[index];
         index++;
       }
 
       offset = 0;
       index = 0;
       while (offset < 1<<15) {
-        unsigned int got = buffer.read(&data_out[offset], dist[d2][index]);
-        BOOST_CHECK_EQUAL(got, dist[d2][index]);
-        offset += dist[d2][index];
+        unsigned int got = buffer.read(&data_out[offset], d2[index]);
+        BOOST_CHECK_EQUAL(got, d2[index]);
+        offset += d2[index];
         index++;
       }
 
@@ -229,8 +229,8 @@
 BOOST_AUTO_TEST_CASE( test_MemoryBuffer_Write_ReadString ) {
   init_data();
 
-  for (int d1 = 0; d1 < 3; d1++) {
-    for (int d2 = 0; d2 < 3; d2++) {
+  for (auto & d1 : dist) {
+    for (auto & d2 : dist) {
       TMemoryBuffer buffer(16);
       string output;
       int offset;
@@ -239,17 +239,17 @@
       offset = 0;
       index = 0;
       while (offset < 1<<15) {
-        buffer.write(&data[offset], dist[d1][index]);
-        offset += dist[d1][index];
+        buffer.write(&data[offset], d1[index]);
+        offset += d1[index];
         index++;
       }
 
       offset = 0;
       index = 0;
       while (offset < 1<<15) {
-        unsigned int got = buffer.readAppendToString(output, dist[d2][index]);
-        BOOST_CHECK_EQUAL(got, dist[d2][index]);
-        offset += dist[d2][index];
+        unsigned int got = buffer.readAppendToString(output, d2[index]);
+        BOOST_CHECK_EQUAL(got, d2[index]);
+        offset += d2[index];
         index++;
       }
 
@@ -263,8 +263,8 @@
 
   // Do shorter writes and reads so we don't align to power-of-two boundaries.
 
-  for (int d1 = 0; d1 < 3; d1++) {
-    for (int d2 = 0; d2 < 3; d2++) {
+  for (auto & d1 : dist) {
+    for (auto & d2 : dist) {
       TMemoryBuffer buffer(16);
       uint8_t data_out[1<<15];
       int offset;
@@ -274,16 +274,16 @@
         offset = 0;
         index = 0;
         while (offset < (1<<15)-42) {
-          buffer.write(&data[offset], dist[d1][index]);
-          offset += dist[d1][index];
+          buffer.write(&data[offset], d1[index]);
+          offset += d1[index];
           index++;
         }
 
         offset = 0;
         index = 0;
         while (offset < (1<<15)-42) {
-          buffer.read(&data_out[offset], dist[d2][index]);
-          offset += dist[d2][index];
+          buffer.read(&data_out[offset], d2[index]);
+          offset += d2[index];
           index++;
         }
 
@@ -303,8 +303,8 @@
   // Pull the buffer out of the loop so its state gets worked harder.
   TMemoryBuffer buffer(16);
 
-  for (int d1 = 0; d1 < 3; d1++) {
-    for (int d2 = 0; d2 < 3; d2++) {
+  for (auto & d1 : dist) {
+    for (auto & d2 : dist) {
       uint8_t data_out[1<<15];
       int offset;
       int index;
@@ -313,16 +313,16 @@
         offset = 0;
         index = 0;
         while (offset < (1<<15)-42) {
-          buffer.write(&data[offset], dist[d1][index]);
-          offset += dist[d1][index];
+          buffer.write(&data[offset], d1[index]);
+          offset += d1[index];
           index++;
         }
 
         offset = 0;
         index = 0;
         while (offset < (1<<15)-42) {
-          buffer.read(&data_out[offset], dist[d2][index]);
-          offset += dist[d2][index];
+          buffer.read(&data_out[offset], d2[index]);
+          offset += d2[index];
           index++;
         }
 
@@ -341,8 +341,8 @@
   // Do shorter writes and reads so we don't align to power-of-two boundaries.
   // Pull the buffer out of the loop so its state gets worked harder.
 
-  for (int d1 = 0; d1 < 3; d1++) {
-    for (int d2 = 0; d2 < 3; d2++) {
+  for (auto & d1 : dist) {
+    for (auto & d2 : dist) {
       TMemoryBuffer buffer(16);
       uint8_t data_out[1<<13];
 
@@ -350,7 +350,7 @@
       int write_index = 0;
       unsigned int to_write = (1<<14)-42;
       while (to_write > 0) {
-        int write_amt = (std::min)(dist[d1][write_index], to_write);
+        int write_amt = (std::min)(d1[write_index], to_write);
         buffer.write(&data[write_offset], write_amt);
         write_offset += write_amt;
         write_index++;
@@ -361,7 +361,7 @@
       int read_index = 0;
       unsigned int to_read = (1<<13)-42;
       while (to_read > 0) {
-        int read_amt = (std::min)(dist[d2][read_index], to_read);
+        int read_amt = (std::min)(d2[read_index], to_read);
         int got = buffer.read(&data_out[read_offset], read_amt);
         BOOST_CHECK_EQUAL(got, read_amt);
         read_offset += read_amt;
@@ -375,7 +375,7 @@
       int second_index = write_index-1;
       unsigned int to_second = (1<<14)+42;
       while (to_second > 0) {
-        int second_amt = (std::min)(dist[d1][second_index], to_second);
+        int second_amt = (std::min)(d1[second_index], to_second);
         //printf("%d\n", second_amt);
         buffer.write(&data[second_offset], second_amt);
         second_offset += second_amt;
@@ -399,17 +399,16 @@
     1<<14, 1<<17,
   };
 
-  for (size_t i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
-    int size = sizes[i];
-    for (int d1 = 0; d1 < 3; d1++) {
+  for (int size : sizes) {
+    for (auto & d1 : dist) {
       shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(16));
       TBufferedTransport trans(buffer, size);
 
       int offset = 0;
       int index = 0;
       while (offset < 1<<15) {
-        trans.write(&data[offset], dist[d1][index]);
-        offset += dist[d1][index];
+        trans.write(&data[offset], d1[index]);
+        offset += d1[index];
         index++;
       }
       trans.flush();
@@ -430,9 +429,8 @@
     1<<14, 1<<17,
   };
 
-  for (size_t i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
-    int size = sizes[i];
-    for (int d1 = 0; d1 < 3; d1++) {
+  for (int size : sizes) {
+    for (auto & d1 : dist) {
       shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(data, sizeof(data)));
       TBufferedTransport trans(buffer, size);
       uint8_t data_out[1<<15];
@@ -443,8 +441,8 @@
         // Note: this doesn't work with "read" because TBufferedTransport
         // doesn't try loop over reads, so we get short reads.  We don't
         // check the return value, so that messes us up.
-        trans.readAll(&data_out[offset], dist[d1][index]);
-        offset += dist[d1][index];
+        trans.readAll(&data_out[offset], d1[index]);
+        offset += d1[index];
         index++;
       }
 
@@ -463,9 +461,8 @@
     1<<14, 1<<17,
   };
 
-  for (size_t i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
-    int size = sizes[i];
-    for (int d1 = 0; d1 < 3; d1++) {
+  for (int size : sizes) {
+    for (auto & d1 : dist) {
       shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(data, sizeof(data)));
       shared_ptr<TShortReadTransport> tshort(new TShortReadTransport(buffer, 0.125));
       TBufferedTransport trans(buffer, size);
@@ -477,8 +474,8 @@
         // Note: this doesn't work with "read" because TBufferedTransport
         // doesn't try loop over reads, so we get short reads.  We don't
         // check the return value, so that messes us up.
-        trans.readAll(&data_out[offset], dist[d1][index]);
-        offset += dist[d1][index];
+        trans.readAll(&data_out[offset], d1[index]);
+        offset += d1[index];
         index++;
       }
 
@@ -497,17 +494,16 @@
     1<<14, 1<<17,
   };
 
-  for (size_t i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
-    int size = sizes[i];
-    for (int d1 = 0; d1 < 3; d1++) {
+  for (int size : sizes) {
+    for (auto & d1 : dist) {
       shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(16));
       TFramedTransport trans(buffer, size);
 
       int offset = 0;
       int index = 0;
       while (offset < 1<<15) {
-        trans.write(&data[offset], dist[d1][index]);
-        offset += dist[d1][index];
+        trans.write(&data[offset], d1[index]);
+        offset += d1[index];
         index++;
       }
       trans.flush();
@@ -526,7 +522,7 @@
 BOOST_AUTO_TEST_CASE( test_FramedTransport_Read ) {
   init_data();
 
-  for (int d1 = 0; d1 < 3; d1++) {
+  for (auto & d1 : dist) {
     uint8_t data_out[1<<15];
     shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer());
     TFramedTransport trans(buffer);
@@ -539,8 +535,8 @@
     int index = 0;
     while (offset < 1<<15) {
       // This should work with read because we have one huge frame.
-      trans.read(&data_out[offset], dist[d1][index]);
-      offset += dist[d1][index];
+      trans.read(&data_out[offset], d1[index]);
+      offset += d1[index];
       index++;
     }
 
@@ -560,11 +556,9 @@
 
   int probs[] = { 1, 2, 4, 8, 16, 32, };
 
-  for (size_t i = 0; i < sizeof (sizes) / sizeof (sizes[0]); i++) {
-    int size = sizes[i];
-    for (size_t j = 0; j < sizeof (probs) / sizeof (probs[0]); j++) {
-      int prob = probs[j];
-      for (int d1 = 0; d1 < 3; d1++) {
+  for (int size : sizes) {
+    for (int prob : probs) {
+      for (auto & d1 : dist) {
         shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(16));
         TFramedTransport trans(buffer, size);
         std::vector<uint8_t> data_out(1<<17, 0);
@@ -574,9 +568,9 @@
         int write_index = 0;
         int flush_size = 0;
         while (write_offset < 1<<15) {
-          trans.write(&data[write_offset], dist[d1][write_index]);
-          write_offset += dist[d1][write_index];
-          flush_size += dist[d1][write_index];
+          trans.write(&data[write_offset], d1[write_index]);
+          write_offset += d1[write_index];
+          flush_size += d1[write_index];
           write_index++;
           if (flush_size > 0 && rand()%prob == 0) {
             flush_sizes.push_back(flush_size);
@@ -593,8 +587,7 @@
         int read_offset = 0;
         int read_index = 0;
 
-        for (unsigned int k = 0; k < flush_sizes.size(); k++) {
-          int fsize = flush_sizes[k];
+        for (int fsize : flush_sizes) {
           // We are exploiting an implementation detail of TFramedTransport.
           // The read buffer starts empty and it will never do more than one
           // readFrame per read, so we should always get exactly one frame.
diff --git a/lib/cpp/test/TFileTransportTest.cpp b/lib/cpp/test/TFileTransportTest.cpp
index ad32185..21c1f3b 100644
--- a/lib/cpp/test/TFileTransportTest.cpp
+++ b/lib/cpp/test/TFileTransportTest.cpp
@@ -279,12 +279,12 @@
   BOOST_WARN_GE(calls->size(), static_cast<FsyncLog::CallList::size_type>(1));
 
   const struct timeval* prev_time = nullptr;
-  for (auto it = calls->begin(); it != calls->end(); ++it) {
+  for (const auto & call : *calls) {
     if (prev_time) {
-      int delta = time_diff(prev_time, &it->time);
+      int delta = time_diff(prev_time, &call.time);
       BOOST_WARN( delta < max_allowed_delta );
     }
-    prev_time = &it->time;
+    prev_time = &call.time;
   }
 }
 
diff --git a/lib/cpp/test/TMemoryBufferTest.cpp b/lib/cpp/test/TMemoryBufferTest.cpp
index 9206872..42f9711 100644
--- a/lib/cpp/test/TMemoryBufferTest.cpp
+++ b/lib/cpp/test/TMemoryBufferTest.cpp
@@ -81,9 +81,9 @@
 }
 
 BOOST_AUTO_TEST_CASE(test_readAppendToString) {
-  string* str1 = new string("abcd1234");
-  TMemoryBuffer buf((uint8_t*)str1->data(),
-                    static_cast<uint32_t>(str1->length()),
+  string str1 = "abcd1234";
+  TMemoryBuffer buf((uint8_t*)str1.data(),
+                    static_cast<uint32_t>(str1.length()),
                     TMemoryBuffer::COPY);
 
   string str3 = "wxyz", str4 = "6789";
diff --git a/lib/cpp/test/TNonblockingSSLServerTest.cpp b/lib/cpp/test/TNonblockingSSLServerTest.cpp
index d0d8688..dc40c12 100644
--- a/lib/cpp/test/TNonblockingSSLServerTest.cpp
+++ b/lib/cpp/test/TNonblockingSSLServerTest.cpp
@@ -151,7 +151,7 @@
     std::shared_ptr<transport::TNonblockingSSLServerSocket> socket;
     Mutex mutex_;
 
-    Runner() {
+    Runner():port(0) {
       listenHandler.reset(new ListenEventHandler(&mutex_));
     }
 
diff --git a/lib/cpp/test/TNonblockingServerTest.cpp b/lib/cpp/test/TNonblockingServerTest.cpp
index 434217e..f9aab4c 100644
--- a/lib/cpp/test/TNonblockingServerTest.cpp
+++ b/lib/cpp/test/TNonblockingServerTest.cpp
@@ -83,6 +83,7 @@
     Mutex mutex_;
 
     Runner() {
+      port = 0;
       listenHandler.reset(new ListenEventHandler(&mutex_));
     }
 
diff --git a/lib/cpp/test/TServerTransportTest.cpp b/lib/cpp/test/TServerTransportTest.cpp
index 15177a8..18a393e 100644
--- a/lib/cpp/test/TServerTransportTest.cpp
+++ b/lib/cpp/test/TServerTransportTest.cpp
@@ -39,7 +39,7 @@
 
 protected:
   shared_ptr<TTransport> acceptImpl() override {
-    return valid_ ? shared_ptr<TestTTransport>(new TestTTransport)
+    return valid_ ? std::make_shared<TestTTransport>()
                   : shared_ptr<TestTTransport>();
   }
 };
diff --git a/lib/cpp/test/TransportTest.cpp b/lib/cpp/test/TransportTest.cpp
index b0c84b6..a890aa8 100644
--- a/lib/cpp/test/TransportTest.cpp
+++ b/lib/cpp/test/TransportTest.cpp
@@ -140,8 +140,8 @@
   std::shared_ptr<Transport_> out;
 
 private:
-  CoupledTransports(const CoupledTransports&);
-  CoupledTransports& operator=(const CoupledTransports&);
+  CoupledTransports(const CoupledTransports&) = delete;
+  CoupledTransports& operator=(const CoupledTransports&) = delete;
 };
 
 /**
diff --git a/lib/cpp/test/concurrency/Tests.cpp b/lib/cpp/test/concurrency/Tests.cpp
index f2b0111..8c734c2 100644
--- a/lib/cpp/test/concurrency/Tests.cpp
+++ b/lib/cpp/test/concurrency/Tests.cpp
@@ -31,8 +31,6 @@
 
 int main(int argc, char** argv) {
 
-  std::string arg;
-
   std::vector<std::string> args(argc - 1 > 1 ? argc - 1 : 1);
 
   args[0] = "all";
