Skip to content

Commit 2d1cb40

Browse files
committed
Assert out of bounds in advance
1 parent e8420f0 commit 2d1cb40

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clang/lib/AST/ASTContext.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5222,13 +5222,14 @@ QualType ASTContext::getDependentBitIntType(bool IsUnsigned,
52225222

52235223
QualType
52245224
ASTContext::getPredefinedSugarType(PredefinedSugarType::Kind KD) const {
5225+
using Kind = PredefinedSugarType::Kind;
5226+
5227+
assert(KD != Kind::Max);
52255228

5226-
auto Target = PredefinedSugarTypes[llvm::to_underlying(KD)];
5229+
auto *Target = PredefinedSugarTypes[llvm::to_underlying(KD)];
52275230
if (Target != nullptr)
52285231
return QualType(Target, 0);
52295232

5230-
using Kind = PredefinedSugarType::Kind;
5231-
52325233
auto getCanonicalType = [](const ASTContext &Ctx, Kind KDI) -> QualType {
52335234
switch (KDI) {
52345235
// size_t (C99TC3 6.5.3.4), signed size_t (C++23 5.13.2) and

0 commit comments

Comments
 (0)