Fix some clang-tidy warnings.
- Local variables marked const cannot use NRVO.
- Merge identical if statements with identical bodies.
Test: presubmit
Change-Id: I7b0d7c864ec9d84a31d950b943f303ecfb249d51
diff --git a/runtime/subtype_check.h b/runtime/subtype_check.h
index ca1feb5..45ca84b 100644
--- a/runtime/subtype_check.h
+++ b/runtime/subtype_check.h
@@ -382,12 +382,12 @@
if (UNLIKELY(!klass->HasSuperClass())) {
// Object root always goes directly from Uninitialized -> Assigned.
- const SubtypeCheckInfo root_sci = GetSubtypeCheckInfo(klass);
+ SubtypeCheckInfo root_sci = GetSubtypeCheckInfo(klass);
if (root_sci.GetState() != SubtypeCheckInfo::kUninitialized) {
return root_sci; // No change needed.
}
- const SubtypeCheckInfo new_root_sci = root_sci.CreateRoot();
+ SubtypeCheckInfo new_root_sci = root_sci.CreateRoot();
SetSubtypeCheckInfo(klass, new_root_sci);
// The object root is always in the Uninitialized|Assigned state.
diff --git a/runtime/subtype_check_info.h b/runtime/subtype_check_info.h
index 05afd76..eef68d7 100644
--- a/runtime/subtype_check_info.h
+++ b/runtime/subtype_check_info.h
@@ -168,9 +168,8 @@
//
// Normally, return kSubtypeOf or kNotSubtypeOf.
Result IsSubtypeOf(const SubtypeCheckInfo& target) {
- if (target.GetState() != SubtypeCheckInfo::kAssigned) {
- return Result::kUnknownSubtypeOf;
- } else if (GetState() == SubtypeCheckInfo::kUninitialized) {
+ if (target.GetState() != SubtypeCheckInfo::kAssigned ||
+ GetState() == SubtypeCheckInfo::kUninitialized) {
return Result::kUnknownSubtypeOf;
}