Fix clang-tidy warnings in aapt and aapt2.
* Add explicit keyword to conversion constructors.
* Add NOLINT(implicit) comments for implicit conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters.
Bug: 30407689
* Add NOLINT to suppress wrong clang-tidy warnings on macros.
Test: build with WITH_TIDY=1
Change-Id: Ibfafb23d9be463b4072745a51a6d9f1812dcac45
diff --git a/tools/aapt2/util/Util.h b/tools/aapt2/util/Util.h
index 4a10987..112437dc 100644
--- a/tools/aapt2/util/Util.h
+++ b/tools/aapt2/util/Util.h
@@ -242,7 +242,7 @@
const iterator mEnd;
};
-inline Tokenizer tokenize(StringPiece str, char sep) {
+inline Tokenizer tokenize(const StringPiece& str, char sep) {
return Tokenizer(str, sep);
}
@@ -281,7 +281,7 @@
* In the aapt namespace for lookup.
*/
inline ::std::ostream& operator<<(::std::ostream& out,
- ::std::function<::std::ostream&(::std::ostream&)> f) {
+ const ::std::function<::std::ostream&(::std::ostream&)>& f) {
return f(out);
}