[clang] f7f5aa2 - [Clang][AMDGPU] Use size_t to compare with npos (#132868)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 25 11:34:15 PDT 2025
Author: Jinsong Ji
Date: 2025-03-25T14:34:12-04:00
New Revision: f7f5aa217a81f2ec036fee765124bd2057531d86
URL: https://github.com/llvm/llvm-project/commit/f7f5aa217a81f2ec036fee765124bd2057531d86
DIFF: https://github.com/llvm/llvm-project/commit/f7f5aa217a81f2ec036fee765124bd2057531d86.diff
LOG: [Clang][AMDGPU] Use size_t to compare with npos (#132868)
Fix error
llvm\clang\tools\amdgpu-arch\AMDGPUArchByHIP.cpp(102,29): error: result
of comparison of constant 18446744073709551615 with expression of type
'unsigned int' is always false
[-Werror,-Wtautological-constant-out-of-range-compare]
102 | StringRef VerStr = (Pos == StringRef::npos) ? S : S.substr(Pos +
1);
Added:
Modified:
clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp
Removed:
################################################################################
diff --git a/clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp b/clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp
index 4803f83f55ac7..02431bf909d6d 100644
--- a/clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp
+++ b/clang/tools/amdgpu-arch/AMDGPUArchByHIP.cpp
@@ -98,7 +98,7 @@ static std::vector<std::string> getSearchPaths() {
// Custom comparison function for dll name
static bool compareVersions(StringRef A, StringRef B) {
auto ParseVersion = [](StringRef S) -> VersionTuple {
- unsigned Pos = S.find_last_of('_');
+ size_t Pos = S.find_last_of('_');
StringRef VerStr = (Pos == StringRef::npos) ? S : S.substr(Pos + 1);
VersionTuple Vt;
(void)Vt.tryParse(VerStr);
More information about the cfe-commits
mailing list