diff options
author | Vlad Serebrennikov <serebrennikov.vladislav@gmail.com> | 2023-11-05 16:38:10 +0300 |
---|---|---|
committer | Vlad Serebrennikov <serebrennikov.vladislav@gmail.com> | 2023-11-05 16:38:45 +0300 |
commit | a9070f22a29e28f7d6f83c24a8dd88f3a94969ae (patch) | |
tree | e2849f1e89ae2cbca73c218a57d2afedfb411a40 /clang/lib/Sema/SemaInit.cpp | |
parent | aa9f14a52d33f4785561a54cc5276b1c6cc354d8 (diff) | |
download | llvm-a9070f22a29e28f7d6f83c24a8dd88f3a94969ae.zip llvm-a9070f22a29e28f7d6f83c24a8dd88f3a94969ae.tar.gz llvm-a9070f22a29e28f7d6f83c24a8dd88f3a94969ae.tar.bz2 |
[clang][NFC] Refactor `CXXConstructExpr::ConstructionKind`
This patch converts `CXXConstructExpr::ConstructionKind` into a scoped enum in namespace scope, making it eligible for forward declaring. This is useful in cases like annotating bit-fields with `preferred_type`.
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 7bec15c..80b51b0 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -6880,15 +6880,12 @@ static ExprResult CopyObject(Sema &S, CurInitExpr->getType()); // Actually perform the constructor call. - CurInit = S.BuildCXXConstructExpr(Loc, T, Best->FoundDecl, Constructor, - Elidable, - ConstructorArgs, - HadMultipleCandidates, - /*ListInit*/ false, - /*StdInitListInit*/ false, - /*ZeroInit*/ false, - CXXConstructExpr::CK_Complete, - SourceRange()); + CurInit = S.BuildCXXConstructExpr( + Loc, T, Best->FoundDecl, Constructor, Elidable, ConstructorArgs, + HadMultipleCandidates, + /*ListInit*/ false, + /*StdInitListInit*/ false, + /*ZeroInit*/ false, CXXConstructionKind::Complete, SourceRange()); // If we're supposed to bind temporaries, do so. if (!CurInit.isInvalid() && shouldBindAsTemporary(Entity)) @@ -7082,15 +7079,14 @@ PerformConstructorInitialization(Sema &S, ConstructorInitRequiresZeroInit), CalleeDecl); } else { - CXXConstructExpr::ConstructionKind ConstructKind = - CXXConstructExpr::CK_Complete; + CXXConstructionKind ConstructKind = CXXConstructionKind::Complete; if (Entity.getKind() == InitializedEntity::EK_Base) { - ConstructKind = Entity.getBaseSpecifier()->isVirtual() ? - CXXConstructExpr::CK_VirtualBase : - CXXConstructExpr::CK_NonVirtualBase; + ConstructKind = Entity.getBaseSpecifier()->isVirtual() + ? CXXConstructionKind::VirtualBase + : CXXConstructionKind::NonVirtualBase; } else if (Entity.getKind() == InitializedEntity::EK_Delegating) { - ConstructKind = CXXConstructExpr::CK_Delegating; + ConstructKind = CXXConstructionKind::Delegating; } // Only get the parenthesis or brace range if it is a list initialization or @@ -8871,15 +8867,12 @@ ExprResult InitializationSequence::Perform(Sema &S, return ExprError(); // Build an expression that constructs a temporary. - CurInit = S.BuildCXXConstructExpr(Loc, Step->Type, - FoundFn, Constructor, - ConstructorArgs, - HadMultipleCandidates, - /*ListInit*/ false, - /*StdInitListInit*/ false, - /*ZeroInit*/ false, - CXXConstructExpr::CK_Complete, - SourceRange()); + CurInit = S.BuildCXXConstructExpr( + Loc, Step->Type, FoundFn, Constructor, ConstructorArgs, + HadMultipleCandidates, + /*ListInit*/ false, + /*StdInitListInit*/ false, + /*ZeroInit*/ false, CXXConstructionKind::Complete, SourceRange()); if (CurInit.isInvalid()) return ExprError(); |