diff --git a/toolchain/check/import_cpp.cpp b/toolchain/check/import_cpp.cpp index d029eecc032b..8df9bbe022cb 100644 --- a/toolchain/check/import_cpp.cpp +++ b/toolchain/check/import_cpp.cpp @@ -446,11 +446,10 @@ static auto ClangLookup(Context& context, SemIR::NameScopeId scope_id, auto scope_clang_decl_context_id = context.name_scopes().Get(scope_id).clang_decl_context_id(); bool found = sema.LookupQualifiedName( - lookup, - clang::dyn_cast(context.sem_ir() - .clang_decls() - .Get(scope_clang_decl_context_id) - .decl)); + lookup, dyn_cast(context.sem_ir() + .clang_decls() + .Get(scope_clang_decl_context_id) + .decl)); if (!found) { return std::nullopt; @@ -720,7 +719,7 @@ static auto ImportClassObjectRepr(Context& context, SemIR::ClassId class_id, // Import fields. for (auto* decl : clang_def->decls()) { - auto* field = clang::dyn_cast(decl); + auto* field = dyn_cast(decl); // Track the chain of fields from the class to this field. This chain is // only one element long unless the field is a member of an anonymous struct @@ -731,7 +730,7 @@ static auto ImportClassObjectRepr(Context& context, SemIR::ClassId class_id, // If this isn't a field, it might be an indirect field in an anonymous // struct or union. if (!field) { - auto* indirect_field = clang::dyn_cast(decl); + auto* indirect_field = dyn_cast(decl); if (!indirect_field) { continue; } @@ -773,12 +772,12 @@ static auto ImportClassObjectRepr(Context& context, SemIR::ClassId class_id, // Compute the offset to the field that appears directly in the class. uint64_t offset = clang_layout.getFieldOffset( - clang::cast(chain.front())->getFieldIndex()); + cast(chain.front())->getFieldIndex()); // If this is an indirect field, walk the path and accumulate the offset to // the named field. for (auto* inner_decl : chain.drop_front()) { - auto* inner_field = clang::cast(inner_decl); + auto* inner_field = cast(inner_decl); const auto& inner_layout = context.ast_context().getASTRecordLayout(inner_field->getParent()); offset += inner_layout.getFieldOffset(inner_field->getFieldIndex()); @@ -930,7 +929,7 @@ static auto MapBuiltinType(Context& context, clang::QualType qual_type, // Maps a C++ record type to a Carbon type. static auto MapRecordType(Context& context, const clang::RecordType& type) -> TypeExpr { - auto* record_decl = clang::dyn_cast(type.getDecl()); + auto* record_decl = dyn_cast(type.getDecl()); if (!record_decl) { return {.inst_id = SemIR::TypeInstId::None, .type_id = SemIR::TypeId::None}; } @@ -1407,7 +1406,7 @@ static auto AddDependentUnimportedDecls(const Context& context, if (auto* clang_function_decl = clang_decl->getAsFunction()) { AddDependentUnimportedFunctionDecls(context, *clang_function_decl, decls); - } else if (auto* type_decl = clang::dyn_cast(clang_decl)) { + } else if (auto* type_decl = dyn_cast(clang_decl)) { AddDependentUnimportedTypeDecls( context, type_decl->getASTContext().getTypeDeclType(type_decl), decls); } @@ -1422,11 +1421,10 @@ static auto ImportDeclAfterDependencies(Context& context, SemIR::LocId loc_id, if (auto* clang_function_decl = clang_decl->getAsFunction()) { return ImportFunctionDecl(context, loc_id, clang_function_decl); } - if (auto* clang_namespace_decl = - clang::dyn_cast(clang_decl)) { + if (auto* clang_namespace_decl = dyn_cast(clang_decl)) { return ImportNamespaceDecl(context, clang_namespace_decl); } - if (auto* type_decl = clang::dyn_cast(clang_decl)) { + if (auto* type_decl = dyn_cast(clang_decl)) { auto type = type_decl->getASTContext().getTypeDeclType(type_decl); auto type_inst_id = MapType(context, loc_id, type).inst_id; if (!type_inst_id.has_value()) { @@ -1436,7 +1434,7 @@ static auto ImportDeclAfterDependencies(Context& context, SemIR::LocId loc_id, } return type_inst_id; } - if (clang::isa(clang_decl)) { + if (isa(clang_decl)) { // Usable fields get imported as a side effect of importing the class. if (SemIR::InstId existing_inst_id = LookupClangDeclInstId(context, clang_decl); diff --git a/toolchain/lower/constant.cpp b/toolchain/lower/constant.cpp index 55679523d860..6b35a7ef272e 100644 --- a/toolchain/lower/constant.cpp +++ b/toolchain/lower/constant.cpp @@ -234,7 +234,7 @@ static auto EmitAsConstant(ConstantContext& context, SemIR::IntValue inst) // IntLiteral is represented as an empty struct. All other integer types are // represented as an LLVM integer type. - auto* int_type = llvm::dyn_cast(type); + auto* int_type = dyn_cast(type); if (!int_type) { auto* int_literal_value = context.GetIntLiteralAsValue(); CARBON_CHECK(int_literal_value->getType() == type); diff --git a/toolchain/lower/mangler.cpp b/toolchain/lower/mangler.cpp index a466299e49b7..d35fa78fd83d 100644 --- a/toolchain/lower/mangler.cpp +++ b/toolchain/lower/mangler.cpp @@ -151,7 +151,7 @@ auto Mangler::Mangle(SemIR::FunctionId function_id, return "main"; } if (function.clang_decl_id.has_value()) { - return MangleCppClang(llvm::dyn_cast( + return MangleCppClang(dyn_cast( sem_ir().clang_decls().Get(function.clang_decl_id).decl)); } RawStringOstream os;