From 39f8ceb518e46541691feb4f5d2f8d882e044b94 Mon Sep 17 00:00:00 2001 From: Per Larsen Date: Fri, 3 Nov 2023 16:48:44 -0700 Subject: [PATCH] Cleanup switch statement in AstExporter.cpp --- c2rust-ast-exporter/src/AstExporter.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/c2rust-ast-exporter/src/AstExporter.cpp b/c2rust-ast-exporter/src/AstExporter.cpp index fc6e78aec1..548e6e8fef 100644 --- a/c2rust-ast-exporter/src/AstExporter.cpp +++ b/c2rust-ast-exporter/src/AstExporter.cpp @@ -389,14 +389,6 @@ class TypeEncoder final : public TypeVisitor { const TypeTag tag = [&] { switch (kind) { - default: { - auto pol = clang::PrintingPolicy(Context->getLangOpts()); - auto warning = std::string("Encountered unsupported BuiltinType kind ") + - std::to_string((int)kind) + " for type " + - T->getName(pol).str(); - printWarning(warning, clang::FullSourceLoc()); - return TagTypeUnknown; - } case BuiltinType::BuiltinFn: return TagBuiltinFn; case BuiltinType::UInt128: return TagUInt128; case BuiltinType::Int128: return TagInt128; @@ -412,9 +404,9 @@ class TypeEncoder final : public TypeVisitor { // built-in to normal vector types. case BuiltinType::Float16: return TagHalf; case BuiltinType::Half: return TagHalf; - #if CLANG_VERSION_MAJOR >= 11 +#if CLANG_VERSION_MAJOR >= 11 case BuiltinType::BFloat16: return TagBFloat16; - #endif +#endif case BuiltinType::Float: return TagFloat; case BuiltinType::Double: return TagDouble; case BuiltinType::LongDouble: return TagLongDouble; @@ -432,6 +424,13 @@ class TypeEncoder final : public TypeVisitor { case BuiltinType::SveBoolx2: return TagSveBoolx2; case BuiltinType::SveBoolx4: return TagSveBoolx4; #endif + default: + auto pol = clang::PrintingPolicy(Context->getLangOpts()); + auto warning = std::string("Encountered unsupported BuiltinType kind ") + + std::to_string((int)kind) + " for type " + + T->getName(pol).str(); + printWarning(warning, clang::FullSourceLoc()); + return TagTypeUnknown; } }();