Skip to content

Commit 50faea2

Browse files
[llvm] Use conventional enum declarations (NFC) (#166318)
This patch replaces: using Foo = enum { A, B, C }; with the more conventional: enum Foo { A, B, C }; These two enum declaration styles are not identical, but their difference does not matter in these .cpp files. With the "using Foo" style, the enum is unnamed and cannot be forward-declared, whereas the conventional style creates a named enum that can be. Since these changes are confined to .cpp files, this distinction has no practical impact here.
1 parent 502742b commit 50faea2

File tree

8 files changed

+9
-12
lines changed

8 files changed

+9
-12
lines changed

llvm/lib/Target/AArch64/AArch64FastISel.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ namespace {
8181
class AArch64FastISel final : public FastISel {
8282
class Address {
8383
public:
84-
using BaseKind = enum {
85-
RegBase,
86-
FrameIndexBase
87-
};
84+
enum BaseKind { RegBase, FrameIndexBase };
8885

8986
private:
9087
BaseKind Kind = RegBase;

llvm/lib/Target/AMDGPU/GCNHazardRecognizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ void GCNHazardRecognizer::RecedeCycle() {
435435
// Helper Functions
436436
//===----------------------------------------------------------------------===//
437437

438-
using HazardFnResult = enum { HazardFound, HazardExpired, NoHazardFound };
438+
enum HazardFnResult { HazardFound, HazardExpired, NoHazardFound };
439439

440440
using IsExpiredFn = function_ref<bool(const MachineInstr &, int WaitStates)>;
441441
using GetNumWaitStatesFn = function_ref<unsigned int(const MachineInstr &)>;

llvm/lib/Target/AMDGPU/GCNNSAReassign.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class GCNNSAReassignImpl {
4343
bool run(MachineFunction &MF);
4444

4545
private:
46-
using NSA_Status = enum {
46+
enum NSA_Status {
4747
NOT_NSA, // Not an NSA instruction
4848
FIXED, // NSA which we cannot modify
4949
NON_CONTIGUOUS, // NSA with non-sequential address which we can try

llvm/lib/Target/ARM/ARMFastISel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ namespace {
8686
// All possible address modes, plus some.
8787
class Address {
8888
public:
89-
using BaseKind = enum { RegBase, FrameIndexBase };
89+
enum BaseKind { RegBase, FrameIndexBase };
9090

9191
private:
9292
BaseKind Kind = RegBase;

llvm/lib/Target/Mips/MipsFastISel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class MipsFastISel final : public FastISel {
8282
// All possible address modes.
8383
class Address {
8484
public:
85-
using BaseKind = enum { RegBase, FrameIndexBase };
85+
enum BaseKind { RegBase, FrameIndexBase };
8686

8787
private:
8888
BaseKind Kind = RegBase;

llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class WebAssemblyFastISel final : public FastISel {
4646
// All possible address modes.
4747
class Address {
4848
public:
49-
using BaseKind = enum { RegBase, FrameIndexBase };
49+
enum BaseKind { RegBase, FrameIndexBase };
5050

5151
private:
5252
BaseKind Kind = RegBase;

llvm/lib/Target/X86/X86VZeroUpper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace {
6666
MachineBasicBlock &MBB);
6767
void addDirtySuccessor(MachineBasicBlock &MBB);
6868

69-
using BlockExitState = enum { PASS_THROUGH, EXITS_CLEAN, EXITS_DIRTY };
69+
enum BlockExitState { PASS_THROUGH, EXITS_CLEAN, EXITS_DIRTY };
7070

7171
static const char* getBlockExitStateName(BlockExitState ST);
7272

llvm/unittests/ADT/FallibleIteratorTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ using namespace llvm;
1919

2020
namespace {
2121

22-
using ItemValid = enum { ValidItem, InvalidItem };
23-
using LinkValid = enum { ValidLink, InvalidLink };
22+
enum ItemValid { ValidItem, InvalidItem };
23+
enum LinkValid { ValidLink, InvalidLink };
2424

2525
class Item {
2626
public:

0 commit comments

Comments
 (0)