Use `auto` to avoid stating the name of the type twice.
PiperOrigin-RevId: 413362538
diff --git a/rs_bindings_from_cc/ast_visitor.cc b/rs_bindings_from_cc/ast_visitor.cc
index 0078c69..1a0b316 100644
--- a/rs_bindings_from_cc/ast_visitor.cc
+++ b/rs_bindings_from_cc/ast_visitor.cc
@@ -358,13 +358,12 @@
std::optional<MappedType> type = std::nullopt;
std::string type_string = qual_type.getAsString();
- if (const clang::PointerType* pointer_type =
- qual_type->getAs<clang::PointerType>()) {
+ if (const auto* pointer_type = qual_type->getAs<clang::PointerType>()) {
auto pointee_type = ConvertType(pointer_type->getPointeeType());
if (pointee_type.ok()) {
type = MappedType::PointerTo(*pointee_type);
}
- } else if (const clang::BuiltinType* builtin_type =
+ } else if (const auto* builtin_type =
qual_type->getAs<clang::BuiltinType>()) {
switch (builtin_type->getKind()) {
case clang::BuiltinType::Bool:
@@ -396,8 +395,7 @@
}
}
}
- } else if (const clang::TagType* tag_type =
- qual_type->getAs<clang::TagType>()) {
+ } else if (const auto* tag_type = qual_type->getAs<clang::TagType>()) {
// TODO(b/202692734): If tag_type is un-importable, fail here.
clang::TagDecl* tag_decl = tag_type->getDecl();