[X86] Convert PICStyles::Style to scoped enum class. NFCI.

Fixes MSVC static analyzer warnings about enum safety, this enum performs no integer math so it'd be better to fix its scope.
This commit is contained in:
Simon Pilgrim 2019-11-03 17:27:51 +00:00
parent e2549a0a25
commit 91661573fd
2 changed files with 11 additions and 11 deletions

View File

@ -324,8 +324,8 @@ X86Subtarget::X86Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
MaybeAlign StackAlignOverride,
unsigned PreferVectorWidthOverride,
unsigned RequiredVectorWidth)
: X86GenSubtargetInfo(TT, CPU, FS), PICStyle(PICStyles::None), TM(TM),
TargetTriple(TT), StackAlignOverride(StackAlignOverride),
: X86GenSubtargetInfo(TT, CPU, FS), PICStyle(PICStyles::Style::None),
TM(TM), TargetTriple(TT), StackAlignOverride(StackAlignOverride),
PreferVectorWidthOverride(PreferVectorWidthOverride),
RequiredVectorWidth(RequiredVectorWidth),
In64BitMode(TargetTriple.getArch() == Triple::x86_64),
@ -337,15 +337,15 @@ X86Subtarget::X86Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
FrameLowering(*this, getStackAlignment()) {
// Determine the PICStyle based on the target selected.
if (!isPositionIndependent())
setPICStyle(PICStyles::None);
setPICStyle(PICStyles::Style::None);
else if (is64Bit())
setPICStyle(PICStyles::RIPRel);
setPICStyle(PICStyles::Style::RIPRel);
else if (isTargetCOFF())
setPICStyle(PICStyles::None);
setPICStyle(PICStyles::Style::None);
else if (isTargetDarwin())
setPICStyle(PICStyles::StubPIC);
setPICStyle(PICStyles::Style::StubPIC);
else if (isTargetELF())
setPICStyle(PICStyles::GOT);
setPICStyle(PICStyles::Style::GOT);
CallLoweringInfo.reset(new X86CallLowering(*getTargetLowering()));
Legalizer.reset(new X86LegalizerInfo(*this, TM));

View File

@ -40,7 +40,7 @@ class GlobalValue;
///
namespace PICStyles {
enum Style {
enum class Style {
StubPIC, // Used on i386-darwin in pic mode.
GOT, // Used on 32 bit elf on when in pic mode.
RIPRel, // Used on X86-64 when in pic mode.
@ -805,11 +805,11 @@ public:
bool isTargetWin32() const { return !In64BitMode && isOSWindows(); }
bool isPICStyleGOT() const { return PICStyle == PICStyles::GOT; }
bool isPICStyleRIPRel() const { return PICStyle == PICStyles::RIPRel; }
bool isPICStyleGOT() const { return PICStyle == PICStyles::Style::GOT; }
bool isPICStyleRIPRel() const { return PICStyle == PICStyles::Style::RIPRel; }
bool isPICStyleStubPIC() const {
return PICStyle == PICStyles::StubPIC;
return PICStyle == PICStyles::Style::StubPIC;
}
bool isPositionIndependent() const { return TM.isPositionIndependent(); }