diff options
author | Dan Liew <dan@su-root.co.uk> | 2024-08-29 12:00:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-29 12:00:28 -0700 |
commit | ff04c5b2e69481fc3b828bfcf32e05ff7a2c4b05 (patch) | |
tree | dff44502eeb3eea0829fc5f1db265040a9d09b92 /clang/lib/Sema/SemaInit.cpp | |
parent | e9eaf19eb605c14bed7a0f76d206c13a8eaf842f (diff) | |
download | llvm-ff04c5b2e69481fc3b828bfcf32e05ff7a2c4b05.zip llvm-ff04c5b2e69481fc3b828bfcf32e05ff7a2c4b05.tar.gz llvm-ff04c5b2e69481fc3b828bfcf32e05ff7a2c4b05.tar.bz2 |
[NFC][Sema] Move `Sema::AssignmentAction` into its own scoped enum (#106453)
The primary motivation behind this is to allow the enum type to be
referred to earlier in the Sema.h file which is needed for #106321.
It was requested in #106321 that a scoped enum be used (rather than
moving the enum declaration earlier in the Sema class declaration).
Unfortunately doing this creates a lot of churn as all use sites of the
enum constants had to be changed. Appologies to all downstream forks in
advanced.
Note the AA_ prefix has been dropped from the enum value names as they
are now redundant.
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 5a19a35..7dc1718 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -6799,43 +6799,44 @@ InitializationSequence::~InitializationSequence() { //===----------------------------------------------------------------------===// // Perform initialization //===----------------------------------------------------------------------===// -static Sema::AssignmentAction -getAssignmentAction(const InitializedEntity &Entity, bool Diagnose = false) { +static AssignmentAction getAssignmentAction(const InitializedEntity &Entity, + bool Diagnose = false) { switch(Entity.getKind()) { case InitializedEntity::EK_Variable: case InitializedEntity::EK_New: case InitializedEntity::EK_Exception: case InitializedEntity::EK_Base: case InitializedEntity::EK_Delegating: - return Sema::AA_Initializing; + return AssignmentAction::Initializing; case InitializedEntity::EK_Parameter: if (Entity.getDecl() && isa<ObjCMethodDecl>(Entity.getDecl()->getDeclContext())) - return Sema::AA_Sending; + return AssignmentAction::Sending; - return Sema::AA_Passing; + return AssignmentAction::Passing; case InitializedEntity::EK_Parameter_CF_Audited: if (Entity.getDecl() && isa<ObjCMethodDecl>(Entity.getDecl()->getDeclContext())) - return Sema::AA_Sending; + return AssignmentAction::Sending; - return !Diagnose ? Sema::AA_Passing : Sema::AA_Passing_CFAudited; + return !Diagnose ? AssignmentAction::Passing + : AssignmentAction::Passing_CFAudited; case InitializedEntity::EK_Result: case InitializedEntity::EK_StmtExprResult: // FIXME: Not quite right. - return Sema::AA_Returning; + return AssignmentAction::Returning; case InitializedEntity::EK_Temporary: case InitializedEntity::EK_RelatedResult: // FIXME: Can we tell apart casting vs. converting? - return Sema::AA_Casting; + return AssignmentAction::Casting; case InitializedEntity::EK_TemplateParameter: // This is really initialization, but refer to it as conversion for // consistency with CheckConvertedConstantExpression. - return Sema::AA_Converting; + return AssignmentAction::Converting; case InitializedEntity::EK_Member: case InitializedEntity::EK_ParenAggInitMember: @@ -6847,7 +6848,7 @@ getAssignmentAction(const InitializedEntity &Entity, bool Diagnose = false) { case InitializedEntity::EK_LambdaToBlockConversionBlockElement: case InitializedEntity::EK_LambdaCapture: case InitializedEntity::EK_CompoundLiteralInit: - return Sema::AA_Initializing; + return AssignmentAction::Initializing; } llvm_unreachable("Invalid EntityKind!"); |