base: tag unique_fd::reset as reinitializing for clang-tidy.
Appease clang-tidy by marking reset() as a method that reinitializes
after moving out of a unique_fd.
Unfortunately, there isn't an attribute that let us mark the type as
being safe to use after move in general, which means that moving out of
a unique_fd and then calling get() on it will still be frowned upon.
clang-tidy has a hard-coded list of standard container types that
are safe to use after move, but doesn't provide a way to mark custom
types as satisfying this condition.
Bug: http://b/150959261
Test: reverted the change to unique_fd.h and the test failed
Change-Id: Ide73d7caa4cd2b192018f111059d696dca4de987
diff --git a/base/Android.bp b/base/Android.bp
index 25c74f2..f2e4122 100644
--- a/base/Android.bp
+++ b/base/Android.bp
@@ -203,6 +203,23 @@
test_suites: ["device-tests"],
}
+cc_test {
+ name: "libbase_tidy_test",
+ defaults: ["libbase_cflags_defaults"],
+ host_supported: true,
+
+ tidy: true,
+ tidy_checks_as_errors: ["bugprone-use-after-move"],
+
+ srcs: [
+ "tidy/unique_fd_test.cpp",
+ "tidy/unique_fd_test2.cpp",
+ ],
+
+ shared_libs: ["libbase"],
+ test_suites: ["device_tests"],
+}
+
cc_benchmark {
name: "libbase_benchmark",
defaults: ["libbase_cflags_defaults"],