[llvm] [nsan] Fix `Wstring-conversion` error (PR #100328)
Dmitry Chestnykh via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 24 01:49:52 PDT 2024
https://github.com/chestnykh updated https://github.com/llvm/llvm-project/pull/100328
>From 04920888873369a1b6a8e9da2b3ec75b312157f3 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Wed, 24 Jul 2024 11:50:29 +0300
Subject: [PATCH 1/2] [nsan] Fix `Wstring-conversion` error
Fix error: implicit conversion turns string literal into bool:
'const char[46]' to 'bool' [-Werror,-Wstring-conversion]
---
.../Transforms/Instrumentation/NumericalStabilitySanitizer.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
index 0b54f571f5508..1441d74cbf646 100644
--- a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
@@ -527,7 +527,7 @@ NsanMemOpFn::NsanMemOpFn(Module &M, ArrayRef<StringRef> Sized,
M.getOrInsertFunction(Fallback, Attr, VoidTy, PtrTy, IntptrTy));
SizedFnTy = FunctionType::get(VoidTy, {PtrTy}, false);
} else {
- assert(!"Unexpected value of sized functions arguments");
+ assert(0 && !"Unexpected value of sized functions arguments");
}
for (size_t i = 0; i < NumSizedFuncs; ++i)
>From 9f48fcd9d6991102acd322226cda2535693f3537 Mon Sep 17 00:00:00 2001
From: Dmitry Chestnykh <dm.chestnykh at gmail.com>
Date: Wed, 24 Jul 2024 11:51:55 +0300
Subject: [PATCH 2/2] [nsan] Remove unneeded '!'
---
.../Transforms/Instrumentation/NumericalStabilitySanitizer.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
index 1441d74cbf646..c3f9f61454eaa 100644
--- a/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp
@@ -527,7 +527,7 @@ NsanMemOpFn::NsanMemOpFn(Module &M, ArrayRef<StringRef> Sized,
M.getOrInsertFunction(Fallback, Attr, VoidTy, PtrTy, IntptrTy));
SizedFnTy = FunctionType::get(VoidTy, {PtrTy}, false);
} else {
- assert(0 && !"Unexpected value of sized functions arguments");
+ assert(0 && "Unexpected value of sized functions arguments");
}
for (size_t i = 0; i < NumSizedFuncs; ++i)
More information about the llvm-commits
mailing list