Fix clang-tidy performance-* warnings in system/libhidl.

* Use const reference parameter type to avoid unnecessary copy.
* Use more efficient overloaded string methods.
* Use const reference type for loop index variables to avoid unnecessary copy.

Bug: 30407689
Bug: 30411878
Bug: 30413223
Test: build with WITH_TIDY=1
Test: libhidl_test
Change-Id: I1deae1f09d56c2fa9cd56728b13ca50305d18f3e
diff --git a/base/HidlInternal.cpp b/base/HidlInternal.cpp
index 5fae1c4..0ff52ad 100644
--- a/base/HidlInternal.cpp
+++ b/base/HidlInternal.cpp
@@ -96,7 +96,7 @@
         instrumentationLibPaths.push_back(HAL_LIBRARY_PATH_ODM);
     }
 
-    for (auto path : instrumentationLibPaths) {
+    for (const auto& path : instrumentationLibPaths) {
         DIR *dir = opendir(path.c_str());
         if (dir == 0) {
             LOG(WARNING) << path << " does not exist. ";
diff --git a/base/include/hidl/Status.h b/base/include/hidl/Status.h
index f812ebb..e2aab3f 100644
--- a/base/include/hidl/Status.h
+++ b/base/include/hidl/Status.h
@@ -143,7 +143,7 @@
         void assertOk() const;
     public:
         return_status() {}
-        return_status(Status s) : mStatus(s) {}
+        return_status(const Status& s) : mStatus(s) {}
 
         return_status(const return_status &) = delete;
         return_status &operator=(const return_status &) = delete;
@@ -240,7 +240,7 @@
 template<> class Return<void> : public details::return_status {
 public:
     Return() : details::return_status() {}
-    Return(Status s) : details::return_status(s) {}
+    Return(const Status& s) : details::return_status(s) {}
 
     // move-able.
     // precondition: "this" has checked status