Skip to content

Commit 97f0f5b

Browse files
[MC, NVPTX] Fix warnings
This patch fixes: llvm/include/llvm/MC/MCRegisterInfo.h:146:7: error: 'llvm::MCRegisterInfo' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor] llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp:163:21: error: comparison of integers of different signs: 'int' and 'size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
1 parent e089382 commit 97f0f5b

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

llvm/include/llvm/MC/MCRegisterInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ class MCRegisterInfo {
268268
friend class MCRegUnitRootIterator;
269269
friend class MCRegAliasIterator;
270270

271+
virtual ~MCRegisterInfo() {}
272+
271273
/// Initialize MCRegisterInfo, called by TableGen
272274
/// auto-generated routines. *DO NOT USE*.
273275
void InitMCRegisterInfo(const MCRegisterDesc *D, unsigned NR, unsigned RA,

llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,8 @@ static uint64_t encodeRegisterForDwarf(std::string registerName) {
160160
// number, which is stored in ULEB128, but in practice must be no more than 8
161161
// bytes (excluding null terminator, which is not included).
162162
uint64_t result = 0;
163-
for (int i = 0; i < registerName.length(); ++i) {
164-
result = result << 8;
165-
unsigned char c = registerName[i];
166-
result |= c;
167-
}
163+
for (unsigned char c : registerName)
164+
result = (result << 8) | c;
168165
return result;
169166
}
170167

0 commit comments

Comments
 (0)