diff options
author | Vlad Serebrennikov <serebrennikov.vladislav@gmail.com> | 2023-10-31 17:43:10 +0300 |
---|---|---|
committer | Vlad Serebrennikov <serebrennikov.vladislav@gmail.com> | 2023-10-31 18:06:34 +0300 |
commit | 49fd28d9601dde429436655ec74234e895c60b89 (patch) | |
tree | fb2e3327b28e4515fd225ba42019a28670d0f481 /clang/lib/Sema/SemaInit.cpp | |
parent | 7d21d7395ccc8613e5a4144a1b9735e5c719cda3 (diff) | |
download | llvm-49fd28d9601dde429436655ec74234e895c60b89.zip llvm-49fd28d9601dde429436655ec74234e895c60b89.tar.gz llvm-49fd28d9601dde429436655ec74234e895c60b89.tar.bz2 |
[clang][NFC] Refactor `ArrayType::ArraySizeModifier`
This patch moves `ArraySizeModifier` before `Type` declaration so that it's complete at `ArrayTypeBitfields` declaration. It's also converted to scoped enum along the way.
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 8f945bc..ec796de 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -200,9 +200,8 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT, // being initialized to a string literal. llvm::APInt ConstVal(32, StrLength); // Return a new array type (C99 6.7.8p22). - DeclT = S.Context.getConstantArrayType(IAT->getElementType(), - ConstVal, nullptr, - ArrayType::Normal, 0); + DeclT = S.Context.getConstantArrayType( + IAT->getElementType(), ConstVal, nullptr, ArraySizeModifier::Normal, 0); updateStringLiteralType(Str, DeclT); return; } @@ -2053,7 +2052,7 @@ void InitListChecker::CheckArrayType(const InitializedEntity &Entity, } DeclType = SemaRef.Context.getConstantArrayType( - elementType, maxElements, nullptr, ArrayType::Normal, 0); + elementType, maxElements, nullptr, ArraySizeModifier::Normal, 0); } if (!hadError) { // If there are any members of the array that get value-initialized, check @@ -4057,7 +4056,7 @@ static bool TryInitializerListConstruction(Sema &S, E.withConst(), llvm::APInt(S.Context.getTypeSize(S.Context.getSizeType()), List->getNumInits()), - nullptr, clang::ArrayType::Normal, 0); + nullptr, clang::ArraySizeModifier::Normal, 0); InitializedEntity HiddenArray = InitializedEntity::InitializeTemporary(ArrayType); InitializationKind Kind = InitializationKind::CreateDirectList( @@ -5513,7 +5512,7 @@ static void TryOrBuildParenListInitialization( if (ResultType.isNull()) { ResultType = S.Context.getConstantArrayType( AT->getElementType(), llvm::APInt(/*numBits=*/32, ArrayLength), - /*SizeExpr=*/nullptr, ArrayType::Normal, 0); + /*SizeExpr=*/nullptr, ArraySizeModifier::Normal, 0); } } else if (auto *RT = Entity.getType()->getAs<RecordType>()) { bool IsUnion = RT->isUnionType(); @@ -9237,10 +9236,8 @@ ExprResult InitializationSequence::Perform(Sema &S, if (const ConstantArrayType *ConstantSource = S.Context.getAsConstantArrayType(CurInit.get()->getType())) { *ResultType = S.Context.getConstantArrayType( - IncompleteDest->getElementType(), - ConstantSource->getSize(), - ConstantSource->getSizeExpr(), - ArrayType::Normal, 0); + IncompleteDest->getElementType(), ConstantSource->getSize(), + ConstantSource->getSizeExpr(), ArraySizeModifier::Normal, 0); } } } @@ -9508,7 +9505,7 @@ static void diagnoseListInit(Sema &S, const InitializedEntity &Entity, E.withConst(), llvm::APInt(S.Context.getTypeSize(S.Context.getSizeType()), InitList->getNumInits()), - nullptr, clang::ArrayType::Normal, 0); + nullptr, clang::ArraySizeModifier::Normal, 0); InitializedEntity HiddenArray = InitializedEntity::InitializeTemporary(ArrayType); return diagnoseListInit(S, HiddenArray, InitList); |