[clang] [ASTContext] Add a break to nested switch in `encodeTypeForFunctionPointerAuth` (PR #99763)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 22 10:31:22 PDT 2024


================
@@ -3363,6 +3363,7 @@ static void encodeTypeForFunctionPointerAuth(const ASTContext &Ctx,
 #include "clang/Basic/RISCVVTypes.def"
       llvm_unreachable("not yet implemented");
     }
+    break;
----------------
AaronBallman wrote:

It would crash anyway if we fell through because the first thing done in `Type::Record` is a `getAs<RecordType>()` followed by `->` which will dereference a null pointer when handed a `BuiltinType`.

I believe the intent here is that all the cases in the nested `switch` are expected to return and that we handle all of the builtin types.

https://github.com/llvm/llvm-project/pull/99763


More information about the cfe-commits mailing list