summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/BinaryFormat/COFF.h40
-rw-r--r--include/llvm/Object/COFF.h2
-rw-r--r--include/llvm/Object/ELFObjectFile.h5
-rw-r--r--include/llvm/Object/MachO.h2
-rw-r--r--include/llvm/Object/ObjectFile.h3
-rw-r--r--include/llvm/Object/RelocVisitor.h2
-rw-r--r--include/llvm/Object/Wasm.h2
-rw-r--r--lib/Analysis/InstructionSimplify.cpp2
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp2
-rw-r--r--lib/Object/COFFObjectFile.cpp2
-rw-r--r--lib/Object/MachOObjectFile.cpp2
-rw-r--r--lib/Object/WasmObjectFile.cpp2
-rw-r--r--lib/ProfileData/InstrProfReader.cpp4
-rw-r--r--lib/ProfileData/SampleProfReader.cpp2
-rw-r--r--lib/Support/ARMAttributeParser.cpp2
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp2
16 files changed, 41 insertions, 35 deletions
diff --git a/include/llvm/BinaryFormat/COFF.h b/include/llvm/BinaryFormat/COFF.h
index 8023f917178..e6bb50cadb1 100644
--- a/include/llvm/BinaryFormat/COFF.h
+++ b/include/llvm/BinaryFormat/COFF.h
@@ -91,7 +91,7 @@ struct BigObjHeader {
uint32_t NumberOfSymbols;
};
-enum MachineTypes {
+enum MachineTypes : unsigned {
MT_Invalid = 0xffff,
IMAGE_FILE_MACHINE_UNKNOWN = 0x0,
@@ -118,7 +118,7 @@ enum MachineTypes {
IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
};
-enum Characteristics {
+enum Characteristics : unsigned {
C_Invalid = 0,
/// The file does not contain base relocations and must be loaded at its
@@ -158,7 +158,7 @@ enum Characteristics {
IMAGE_FILE_BYTES_REVERSED_HI = 0x8000
};
-enum ResourceTypeID {
+enum ResourceTypeID : unsigned {
RID_Cursor = 1,
RID_Bitmap = 2,
RID_Icon = 3,
@@ -234,7 +234,7 @@ enum SymbolStorageClass {
IMAGE_SYM_CLASS_CLR_TOKEN = 107
};
-enum SymbolBaseType {
+enum SymbolBaseType : unsigned {
IMAGE_SYM_TYPE_NULL = 0, ///< No type information or unknown base type.
IMAGE_SYM_TYPE_VOID = 1, ///< Used with void pointers and functions.
IMAGE_SYM_TYPE_CHAR = 2, ///< A character (signed byte).
@@ -253,7 +253,7 @@ enum SymbolBaseType {
IMAGE_SYM_TYPE_DWORD = 15 ///< An unsigned 4-byte integer.
};
-enum SymbolComplexType {
+enum SymbolComplexType : unsigned {
IMAGE_SYM_DTYPE_NULL = 0, ///< No complex type; simple scalar variable.
IMAGE_SYM_DTYPE_POINTER = 1, ///< A pointer to base type.
IMAGE_SYM_DTYPE_FUNCTION = 2, ///< A function that returns a base type.
@@ -325,7 +325,7 @@ struct relocation {
uint16_t Type;
};
-enum RelocationTypeI386 {
+enum RelocationTypeI386 : unsigned {
IMAGE_REL_I386_ABSOLUTE = 0x0000,
IMAGE_REL_I386_DIR16 = 0x0001,
IMAGE_REL_I386_REL16 = 0x0002,
@@ -339,7 +339,7 @@ enum RelocationTypeI386 {
IMAGE_REL_I386_REL32 = 0x0014
};
-enum RelocationTypeAMD64 {
+enum RelocationTypeAMD64 : unsigned {
IMAGE_REL_AMD64_ABSOLUTE = 0x0000,
IMAGE_REL_AMD64_ADDR64 = 0x0001,
IMAGE_REL_AMD64_ADDR32 = 0x0002,
@@ -359,7 +359,7 @@ enum RelocationTypeAMD64 {
IMAGE_REL_AMD64_SSPAN32 = 0x0010
};
-enum RelocationTypesARM {
+enum RelocationTypesARM : unsigned {
IMAGE_REL_ARM_ABSOLUTE = 0x0000,
IMAGE_REL_ARM_ADDR32 = 0x0001,
IMAGE_REL_ARM_ADDR32NB = 0x0002,
@@ -377,7 +377,7 @@ enum RelocationTypesARM {
IMAGE_REL_ARM_BLX23T = 0x0015
};
-enum RelocationTypesARM64 {
+enum RelocationTypesARM64 : unsigned {
IMAGE_REL_ARM64_ABSOLUTE = 0x0000,
IMAGE_REL_ARM64_ADDR32 = 0x0001,
IMAGE_REL_ARM64_ADDR32NB = 0x0002,
@@ -397,7 +397,7 @@ enum RelocationTypesARM64 {
IMAGE_REL_ARM64_BRANCH14 = 0x0010,
};
-enum COMDATType {
+enum COMDATType : unsigned {
IMAGE_COMDAT_SELECT_NODUPLICATES = 1,
IMAGE_COMDAT_SELECT_ANY,
IMAGE_COMDAT_SELECT_SAME_SIZE,
@@ -430,7 +430,7 @@ struct AuxiliaryWeakExternal {
uint8_t unused[10];
};
-enum WeakExternalCharacteristics {
+enum WeakExternalCharacteristics : unsigned {
IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY = 1,
IMAGE_WEAK_EXTERN_SEARCH_LIBRARY = 2,
IMAGE_WEAK_EXTERN_SEARCH_ALIAS = 3
@@ -572,7 +572,7 @@ struct DataDirectory {
uint32_t Size;
};
-enum DataDirectoryIndex {
+enum DataDirectoryIndex : unsigned {
EXPORT_TABLE = 0,
IMPORT_TABLE,
RESOURCE_TABLE,
@@ -592,7 +592,7 @@ enum DataDirectoryIndex {
NUM_DATA_DIRECTORIES
};
-enum WindowsSubsystem {
+enum WindowsSubsystem : unsigned {
IMAGE_SUBSYSTEM_UNKNOWN = 0, ///< An unknown subsystem.
IMAGE_SUBSYSTEM_NATIVE = 1, ///< Device drivers and native Windows processes
IMAGE_SUBSYSTEM_WINDOWS_GUI = 2, ///< The Windows GUI subsystem.
@@ -611,7 +611,7 @@ enum WindowsSubsystem {
IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16 ///< A BCD application.
};
-enum DLLCharacteristics {
+enum DLLCharacteristics : unsigned {
/// ASLR with 64 bit address space.
IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA = 0x0020,
/// DLL can be relocated at load time.
@@ -637,7 +637,7 @@ enum DLLCharacteristics {
IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000
};
-enum DebugType {
+enum DebugType : unsigned {
IMAGE_DEBUG_TYPE_UNKNOWN = 0,
IMAGE_DEBUG_TYPE_COFF = 1,
IMAGE_DEBUG_TYPE_CODEVIEW = 2,
@@ -657,7 +657,7 @@ enum DebugType {
IMAGE_DEBUG_TYPE_REPRO = 16,
};
-enum BaseRelocationType {
+enum BaseRelocationType : unsigned {
IMAGE_REL_BASED_ABSOLUTE = 0,
IMAGE_REL_BASED_HIGH = 1,
IMAGE_REL_BASED_LOW = 2,
@@ -670,9 +670,13 @@ enum BaseRelocationType {
IMAGE_REL_BASED_DIR64 = 10
};
-enum ImportType { IMPORT_CODE = 0, IMPORT_DATA = 1, IMPORT_CONST = 2 };
+enum ImportType : unsigned {
+ IMPORT_CODE = 0,
+ IMPORT_DATA = 1,
+ IMPORT_CONST = 2
+};
-enum ImportNameType {
+enum ImportNameType : unsigned {
/// Import is by ordinal. This indicates that the value in the Ordinal/Hint
/// field of the import header is the import's ordinal. If this constant is
/// not specified, then the Ordinal/Hint field should always be interpreted
diff --git a/include/llvm/Object/COFF.h b/include/llvm/Object/COFF.h
index 883a49888be..b072dd5ba7d 100644
--- a/include/llvm/Object/COFF.h
+++ b/include/llvm/Object/COFF.h
@@ -926,7 +926,7 @@ public:
uint8_t getBytesInAddress() const override;
StringRef getFileFormatName() const override;
- unsigned getArch() const override;
+ Triple::ArchType getArch() const override;
SubtargetFeatures getFeatures() const override { return SubtargetFeatures(); }
import_directory_iterator import_directory_begin() const;
diff --git a/include/llvm/Object/ELFObjectFile.h b/include/llvm/Object/ELFObjectFile.h
index 905ce450f7f..40503cb6bb9 100644
--- a/include/llvm/Object/ELFObjectFile.h
+++ b/include/llvm/Object/ELFObjectFile.h
@@ -362,7 +362,7 @@ public:
uint8_t getBytesInAddress() const override;
StringRef getFileFormatName() const override;
- unsigned getArch() const override;
+ Triple::ArchType getArch() const override;
std::error_code getPlatformFlags(unsigned &Result) const override {
Result = EF.getHeader()->e_flags;
@@ -1026,8 +1026,7 @@ StringRef ELFObjectFile<ELFT>::getFileFormatName() const {
}
}
-template <class ELFT>
-unsigned ELFObjectFile<ELFT>::getArch() const {
+template <class ELFT> Triple::ArchType ELFObjectFile<ELFT>::getArch() const {
bool IsLittleEndian = ELFT::TargetEndianness == support::little;
switch (EF.getHeader()->e_machine) {
case ELF::EM_386:
diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h
index 03fd52fb482..59297eaffbd 100644
--- a/include/llvm/Object/MachO.h
+++ b/include/llvm/Object/MachO.h
@@ -360,7 +360,7 @@ public:
uint8_t getBytesInAddress() const override;
StringRef getFileFormatName() const override;
- unsigned getArch() const override;
+ Triple::ArchType getArch() const override;
SubtargetFeatures getFeatures() const override { return SubtargetFeatures(); }
Triple getArchTriple(const char **McpuDefault = nullptr) const;
diff --git a/include/llvm/Object/ObjectFile.h b/include/llvm/Object/ObjectFile.h
index c7943512f0c..079a5946815 100644
--- a/include/llvm/Object/ObjectFile.h
+++ b/include/llvm/Object/ObjectFile.h
@@ -15,6 +15,7 @@
#define LLVM_OBJECT_OBJECTFILE_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/BinaryFormat/Magic.h"
#include "llvm/MC/SubtargetFeature.h"
@@ -279,7 +280,7 @@ public:
virtual uint8_t getBytesInAddress() const = 0;
virtual StringRef getFileFormatName() const = 0;
- virtual /* Triple::ArchType */ unsigned getArch() const = 0;
+ virtual Triple::ArchType getArch() const = 0;
virtual SubtargetFeatures getFeatures() const = 0;
virtual void setARMSubArch(Triple &TheTriple) const { }
diff --git a/include/llvm/Object/RelocVisitor.h b/include/llvm/Object/RelocVisitor.h
index c1e2a82c9f8..2d0e938f06f 100644
--- a/include/llvm/Object/RelocVisitor.h
+++ b/include/llvm/Object/RelocVisitor.h
@@ -302,6 +302,8 @@ private:
return Value;
}
break;
+ default:
+ break;
}
HasError = true;
return 0;
diff --git a/include/llvm/Object/Wasm.h b/include/llvm/Object/Wasm.h
index e38b9437791..589c0b5ea11 100644
--- a/include/llvm/Object/Wasm.h
+++ b/include/llvm/Object/Wasm.h
@@ -201,7 +201,7 @@ public:
section_iterator section_end() const override;
uint8_t getBytesInAddress() const override;
StringRef getFileFormatName() const override;
- unsigned getArch() const override;
+ Triple::ArchType getArch() const override;
SubtargetFeatures getFeatures() const override;
bool isRelocatableObject() const override;
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp
index a95f9ace37c..3ce1281743c 100644
--- a/lib/Analysis/InstructionSimplify.cpp
+++ b/lib/Analysis/InstructionSimplify.cpp
@@ -327,7 +327,7 @@ static Value *ThreadBinOpOverSelect(Instruction::BinaryOps Opcode, Value *LHS,
// Check that the simplified value has the form "X op Y" where "op" is the
// same as the original operation.
Instruction *Simplified = dyn_cast<Instruction>(FV ? FV : TV);
- if (Simplified && Simplified->getOpcode() == Opcode) {
+ if (Simplified && Simplified->getOpcode() == unsigned(Opcode)) {
// The value that didn't simplify is "UnsimplifiedLHS op UnsimplifiedRHS".
// We already know that "op" is the same as for the simplified value. See
// if the operands match too. If so, return the simplified value.
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index aa1f71a2b7f..3dc02f566a5 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1769,7 +1769,7 @@ void SelectionDAGBuilder::FindMergedConditions(const Value *Cond,
// If this node is not part of the or/and tree, emit it as a branch.
if (!BOp || !(isa<BinaryOperator>(BOp) || isa<CmpInst>(BOp)) ||
- BOpc != Opc || !BOp->hasOneUse() ||
+ BOpc != unsigned(Opc) || !BOp->hasOneUse() ||
BOp->getParent() != CurBB->getBasicBlock() ||
!InBlock(BOp->getOperand(0), CurBB->getBasicBlock()) ||
!InBlock(BOp->getOperand(1), CurBB->getBasicBlock())) {
diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp
index 06ac6df79ad..b544fa5c147 100644
--- a/lib/Object/COFFObjectFile.cpp
+++ b/lib/Object/COFFObjectFile.cpp
@@ -895,7 +895,7 @@ StringRef COFFObjectFile::getFileFormatName() const {
}
}
-unsigned COFFObjectFile::getArch() const {
+Triple::ArchType COFFObjectFile::getArch() const {
switch (getMachine()) {
case COFF::IMAGE_FILE_MACHINE_I386:
return Triple::x86;
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp
index 4620fdde81d..83becc41319 100644
--- a/lib/Object/MachOObjectFile.cpp
+++ b/lib/Object/MachOObjectFile.cpp
@@ -2573,7 +2573,7 @@ bool MachOObjectFile::isValidArch(StringRef ArchFlag) {
.Default(false);
}
-unsigned MachOObjectFile::getArch() const {
+Triple::ArchType MachOObjectFile::getArch() const {
return getArch(getCPUType(*this));
}
diff --git a/lib/Object/WasmObjectFile.cpp b/lib/Object/WasmObjectFile.cpp
index 677fccc6299..41377579ae0 100644
--- a/lib/Object/WasmObjectFile.cpp
+++ b/lib/Object/WasmObjectFile.cpp
@@ -1038,7 +1038,7 @@ uint8_t WasmObjectFile::getBytesInAddress() const { return 4; }
StringRef WasmObjectFile::getFileFormatName() const { return "WASM"; }
-unsigned WasmObjectFile::getArch() const { return Triple::wasm32; }
+Triple::ArchType WasmObjectFile::getArch() const { return Triple::wasm32; }
SubtargetFeatures WasmObjectFile::getFeatures() const {
return SubtargetFeatures();
diff --git a/lib/ProfileData/InstrProfReader.cpp b/lib/ProfileData/InstrProfReader.cpp
index cdf50c2df0c..23c9a2676b9 100644
--- a/lib/ProfileData/InstrProfReader.cpp
+++ b/lib/ProfileData/InstrProfReader.cpp
@@ -61,7 +61,7 @@ InstrProfReader::create(const Twine &Path) {
Expected<std::unique_ptr<InstrProfReader>>
InstrProfReader::create(std::unique_ptr<MemoryBuffer> Buffer) {
// Sanity check the buffer.
- if (Buffer->getBufferSize() > std::numeric_limits<unsigned>::max())
+ if (uint64_t(Buffer->getBufferSize()) > std::numeric_limits<unsigned>::max())
return make_error<InstrProfError>(instrprof_error::too_large);
if (Buffer->getBufferSize() == 0)
@@ -99,7 +99,7 @@ IndexedInstrProfReader::create(const Twine &Path) {
Expected<std::unique_ptr<IndexedInstrProfReader>>
IndexedInstrProfReader::create(std::unique_ptr<MemoryBuffer> Buffer) {
// Sanity check the buffer.
- if (Buffer->getBufferSize() > std::numeric_limits<unsigned>::max())
+ if (uint64_t(Buffer->getBufferSize()) > std::numeric_limits<unsigned>::max())
return make_error<InstrProfError>(instrprof_error::too_large);
// Create the reader.
diff --git a/lib/ProfileData/SampleProfReader.cpp b/lib/ProfileData/SampleProfReader.cpp
index 1028c35e8c2..44547e3dffa 100644
--- a/lib/ProfileData/SampleProfReader.cpp
+++ b/lib/ProfileData/SampleProfReader.cpp
@@ -749,7 +749,7 @@ setupMemoryBuffer(const Twine &Filename) {
auto Buffer = std::move(BufferOrErr.get());
// Sanity check the file.
- if (Buffer->getBufferSize() > std::numeric_limits<uint32_t>::max())
+ if (uint64_t(Buffer->getBufferSize()) > std::numeric_limits<uint32_t>::max())
return sampleprof_error::too_large;
return std::move(Buffer);
diff --git a/lib/Support/ARMAttributeParser.cpp b/lib/Support/ARMAttributeParser.cpp
index a9a0c1d1a4d..3d800eb7a96 100644
--- a/lib/Support/ARMAttributeParser.cpp
+++ b/lib/Support/ARMAttributeParser.cpp
@@ -592,7 +592,7 @@ void ARMAttributeParser::ParseAttributeList(const uint8_t *Data,
bool Handled = false;
for (unsigned AHI = 0, AHE = array_lengthof(DisplayRoutines);
AHI != AHE && !Handled; ++AHI) {
- if (DisplayRoutines[AHI].Attribute == Tag) {
+ if (uint64_t(DisplayRoutines[AHI].Attribute) == Tag) {
(this->*DisplayRoutines[AHI].Routine)(ARMBuildAttrs::AttrType(Tag),
Data, Offset);
Handled = true;
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index 04eb047059a..64a3f5f9025 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -30276,7 +30276,7 @@ static SDValue matchBinOpReduction(SDNode *Extract, unsigned &BinOp,
// Match against one of the candidate binary ops.
if (llvm::none_of(CandidateBinOps, [Op](ISD::NodeType BinOp) {
- return Op.getOpcode() == BinOp;
+ return Op.getOpcode() == unsigned(BinOp);
}))
return SDValue();