Enable clang_tidy for AIDL-generated C++ libraries

tidy is enabled for the cpp and ndk backends. The AIDL compiler is
modified to emit code that doesn't break the tidy checks.

Bug: 162909698
Test: m checkbuild
Test: run aidl_unittests
Change-Id: I0df916e5df15dba85b75603a544d4666594526ea
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp
index c51f655..3eb9eb9 100644
--- a/aidl_unittest.cpp
+++ b/aidl_unittest.cpp
@@ -3037,7 +3037,8 @@
   Foo& operator=(const Foo&) = default;
   Foo& operator=(Foo&&) = default;
 
-  template <typename _Tp, std::enable_if_t<_not_self<_Tp>, int> = 0>
+  template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
+  // NOLINTNEXTLINE(google-explicit-constructor)
   constexpr Foo(_Tp&& _arg)
       : _value(std::forward<_Tp>(_arg)) {}
 
@@ -3121,17 +3122,32 @@
   case ns: {
     ::std::vector<int32_t> _aidl_value;
     if ((_aidl_ret_status = _aidl_parcel->readInt32Vector(&_aidl_value)) != ::android::OK) return _aidl_ret_status;
-    set<ns>(std::move(_aidl_value));
+    if constexpr (std::is_trivially_copyable_v<::std::vector<int32_t>>) {
+      set<ns>(_aidl_value);
+    } else {
+      // NOLINTNEXTLINE(performance-move-const-arg)
+      set<ns>(std::move(_aidl_value));
+    }
     return ::android::OK; }
   case e: {
     ::a::ByteEnum _aidl_value;
     if ((_aidl_ret_status = _aidl_parcel->readByte(reinterpret_cast<int8_t *>(&_aidl_value))) != ::android::OK) return _aidl_ret_status;
-    set<e>(std::move(_aidl_value));
+    if constexpr (std::is_trivially_copyable_v<::a::ByteEnum>) {
+      set<e>(_aidl_value);
+    } else {
+      // NOLINTNEXTLINE(performance-move-const-arg)
+      set<e>(std::move(_aidl_value));
+    }
     return ::android::OK; }
   case pfd: {
     ::android::os::ParcelFileDescriptor _aidl_value;
     if ((_aidl_ret_status = _aidl_parcel->readParcelable(&_aidl_value)) != ::android::OK) return _aidl_ret_status;
-    set<pfd>(std::move(_aidl_value));
+    if constexpr (std::is_trivially_copyable_v<::android::os::ParcelFileDescriptor>) {
+      set<pfd>(_aidl_value);
+    } else {
+      // NOLINTNEXTLINE(performance-move-const-arg)
+      set<pfd>(std::move(_aidl_value));
+    }
     return ::android::OK; }
   }
   return ::android::BAD_VALUE;
@@ -3192,7 +3208,8 @@
   Foo& operator=(const Foo&) = default;
   Foo& operator=(Foo&&) = default;
 
-  template <typename _Tp, std::enable_if_t<_not_self<_Tp>, int> = 0>
+  template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
+  // NOLINTNEXTLINE(google-explicit-constructor)
   constexpr Foo(_Tp&& _arg)
       : _value(std::forward<_Tp>(_arg)) {}
 
@@ -3277,17 +3294,32 @@
   case ns: {
     std::vector<int32_t> _aidl_value;
     if ((_aidl_ret_status = ::ndk::AParcel_readVector(_parcel, &_aidl_value)) != STATUS_OK) return _aidl_ret_status;
-    set<ns>(std::move(_aidl_value));
+    if constexpr (std::is_trivially_copyable_v<std::vector<int32_t>>) {
+      set<ns>(_aidl_value);
+    } else {
+      // NOLINTNEXTLINE(performance-move-const-arg)
+      set<ns>(std::move(_aidl_value));
+    }
     return STATUS_OK; }
   case e: {
     ::aidl::a::ByteEnum _aidl_value;
     if ((_aidl_ret_status = AParcel_readByte(_parcel, reinterpret_cast<int8_t*>(&_aidl_value))) != STATUS_OK) return _aidl_ret_status;
-    set<e>(std::move(_aidl_value));
+    if constexpr (std::is_trivially_copyable_v<::aidl::a::ByteEnum>) {
+      set<e>(_aidl_value);
+    } else {
+      // NOLINTNEXTLINE(performance-move-const-arg)
+      set<e>(std::move(_aidl_value));
+    }
     return STATUS_OK; }
   case pfd: {
     ::ndk::ScopedFileDescriptor _aidl_value;
     if ((_aidl_ret_status = ::ndk::AParcel_readRequiredParcelFileDescriptor(_parcel, &_aidl_value)) != STATUS_OK) return _aidl_ret_status;
-    set<pfd>(std::move(_aidl_value));
+    if constexpr (std::is_trivially_copyable_v<::ndk::ScopedFileDescriptor>) {
+      set<pfd>(_aidl_value);
+    } else {
+      // NOLINTNEXTLINE(performance-move-const-arg)
+      set<pfd>(std::move(_aidl_value));
+    }
     return STATUS_OK; }
   }
   return STATUS_BAD_VALUE;