Merge "Fix pass driver's dump_pass_list_ and print_pass_list_."
diff --git a/compiler/dex/pass_driver.h b/compiler/dex/pass_driver.h
index 788f24b..bd8f53c 100644
--- a/compiler/dex/pass_driver.h
+++ b/compiler/dex/pass_driver.h
@@ -153,12 +153,12 @@
     default_print_passes_ = true;
   }
 
-  static void SetDumpPassList(const char* list) {
-    dump_pass_list_.reset(list);
+  static void SetDumpPassList(const std::string& list) {
+    dump_pass_list_ = list;
   }
 
-  static void SetPrintPassList(const char* list) {
-    print_pass_list_.reset(list);
+  static void SetPrintPassList(const std::string& list) {
+    print_pass_list_ = list;
   }
 
   void SetDefaultPasses() {
@@ -202,10 +202,10 @@
   static bool default_print_passes_;
 
   /** @brief What are the passes we want to be printing the log messages? */
-  static std::unique_ptr<const char> print_pass_list_;
+  static std::string print_pass_list_;
 
   /** @brief What are the passes we want to be dumping the CFG? */
-  static std::unique_ptr<const char> dump_pass_list_;
+  static std::string dump_pass_list_;
 };
 
 }  // namespace art
diff --git a/compiler/dex/pass_driver_me.cc b/compiler/dex/pass_driver_me.cc
index 099cfee..e6d90e0 100644
--- a/compiler/dex/pass_driver_me.cc
+++ b/compiler/dex/pass_driver_me.cc
@@ -79,11 +79,11 @@
 
 // By default, do not have a dump pass list.
 template<>
-std::unique_ptr<const char> PassDriver<PassDriverME>::dump_pass_list_(nullptr);
+std::string PassDriver<PassDriverME>::dump_pass_list_ = std::string();
 
 // By default, do not have a print pass list.
 template<>
-std::unique_ptr<const char> PassDriver<PassDriverME>::print_pass_list_(nullptr);
+std::string PassDriver<PassDriverME>::print_pass_list_ = std::string();
 
 // By default, we do not print the pass' information.
 template<>
@@ -155,7 +155,7 @@
 
     c_unit->print_pass = default_print_passes_;
 
-    const char* print_pass_list = print_pass_list_.get();
+    const char* print_pass_list = print_pass_list_.c_str();
 
     if (print_pass_list != nullptr && strstr(print_pass_list, pass->GetName()) != nullptr) {
       c_unit->print_pass = true;
@@ -167,7 +167,7 @@
     // Do we want to log it?
     bool should_dump = ((c_unit->enable_debug & (1 << kDebugDumpCFG)) != 0);
 
-    const char* dump_pass_list = dump_pass_list_.get();
+    const char* dump_pass_list = dump_pass_list_.c_str();
 
     if (dump_pass_list != nullptr) {
       bool found = strstr(dump_pass_list, pass->GetName());
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 91a1418..4d3d664 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -925,18 +925,12 @@
       PassDriverME::CreateDefaultPassList(disable_passes);
     } else if (option.starts_with("--print-passes=")) {
       std::string print_passes = option.substr(strlen("--print-passes=")).data();
-      size_t len = print_passes.length() + 1;
-      char* duplicate = new char[len];
-      strncpy(duplicate, print_passes.c_str(), len);
-      PassDriverME::SetPrintPassList(duplicate);
+      PassDriverME::SetPrintPassList(print_passes);
     } else if (option == "--print-all-passes") {
       PassDriverME::SetPrintAllPasses();
     } else if (option.starts_with("--dump-cfg-passes=")) {
       std::string dump_passes = option.substr(strlen("--dump-cfg-passes=")).data();
-      size_t len = dump_passes.length() + 1;
-      char* duplicate = new char[len];
-      strncpy(duplicate, dump_passes.c_str(), len);
-      PassDriverME::SetDumpPassList(duplicate);
+      PassDriverME::SetDumpPassList(dump_passes);
     } else {
       Usage("Unknown argument %s", option.data());
     }