Fix clang-tidy performance warnings.
* Use const reference type for parameters, local variables,
and for-loop index variables to avoid unnecessary copy.
Bug: 30407689
Bug: 30413223
Bug: 30413862
Change-Id: Ia09c58becfa3980faed24aa7eddeb520207ca259
Test: build with WITH_TIDY=1
diff --git a/aidl.cpp b/aidl.cpp
index 513aaee..cd778fa 100644
--- a/aidl.cpp
+++ b/aidl.cpp
@@ -330,7 +330,7 @@
string generate_outputFileName(const JavaOptions& options,
const AidlInterface& interface) {
- string name = interface.GetName();
+ const string& name = interface.GetName();
string package = interface.GetPackage();
string result;
@@ -536,8 +536,8 @@
}
AidlError load_and_validate_aidl(
- const std::vector<std::string> preprocessed_files,
- const std::vector<std::string> import_paths,
+ const std::vector<std::string>& preprocessed_files,
+ const std::vector<std::string>& import_paths,
const std::string& input_file_name,
const IoDelegate& io_delegate,
TypeNamespace* types,