[llvm] b1fcca3 - Fixed warnings in LLVM produced by -Wbitwise-instead-of-logical
Dávid Bolvanský via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 3 04:04:59 PDT 2021
Author: Dávid Bolvanský
Date: 2021-10-03T13:04:18+02:00
New Revision: b1fcca38844138d1950e1b34eb2be65b3bfc7352
URL: https://github.com/llvm/llvm-project/commit/b1fcca38844138d1950e1b34eb2be65b3bfc7352
DIFF: https://github.com/llvm/llvm-project/commit/b1fcca38844138d1950e1b34eb2be65b3bfc7352.diff
LOG: Fixed warnings in LLVM produced by -Wbitwise-instead-of-logical
Added:
Modified:
clang/lib/AST/Type.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaExpr.cpp
llvm/unittests/Support/TargetParserTest.cpp
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 112218d6eb36..de57b40b221a 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -3759,8 +3759,8 @@ class CachedProperties {
friend CachedProperties merge(CachedProperties L, CachedProperties R) {
Linkage MergedLinkage = minLinkage(L.L, R.L);
- return CachedProperties(MergedLinkage,
- L.hasLocalOrUnnamedType() | R.hasLocalOrUnnamedType());
+ return CachedProperties(MergedLinkage, L.hasLocalOrUnnamedType() ||
+ R.hasLocalOrUnnamedType());
}
};
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 5c92e1e7e073..a62a4d60830d 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -668,9 +668,9 @@ bool CodeGenFunction::isVptrCheckRequired(TypeCheckKind TCK, QualType Ty) {
}
bool CodeGenFunction::sanitizePerformTypeCheck() const {
- return SanOpts.has(SanitizerKind::Null) |
- SanOpts.has(SanitizerKind::Alignment) |
- SanOpts.has(SanitizerKind::ObjectSize) |
+ return SanOpts.has(SanitizerKind::Null) ||
+ SanOpts.has(SanitizerKind::Alignment) ||
+ SanOpts.has(SanitizerKind::ObjectSize) ||
SanOpts.has(SanitizerKind::Vptr);
}
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 8b53e3504e13..615ba1aef8e6 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -2988,7 +2988,7 @@ bool Sema::CheckHexagonBuiltinArgument(unsigned BuiltinID, CallExpr *TheCall) {
unsigned M = 1 << A.Align;
Min *= M;
Max *= M;
- Error |= SemaBuiltinConstantArgRange(TheCall, A.OpNum, Min, Max) |
+ Error |= SemaBuiltinConstantArgRange(TheCall, A.OpNum, Min, Max) ||
SemaBuiltinConstantArgMultiple(TheCall, A.OpNum, M);
}
}
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 8d483f317a42..aedfc07c466d 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -8377,7 +8377,7 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
// OpenCL v2.0 s6.12.5 - Blocks cannot be used as expressions of the ternary
// selection operator (?:).
if (getLangOpts().OpenCL &&
- (checkBlockType(*this, LHS.get()) | checkBlockType(*this, RHS.get()))) {
+ ((int)checkBlockType(*this, LHS.get()) | (int)checkBlockType(*this, RHS.get()))) {
return QualType();
}
diff --git a/llvm/unittests/Support/TargetParserTest.cpp b/llvm/unittests/Support/TargetParserTest.cpp
index a465eb0c57c7..de63efdf7276 100644
--- a/llvm/unittests/Support/TargetParserTest.cpp
+++ b/llvm/unittests/Support/TargetParserTest.cpp
@@ -1181,9 +1181,9 @@ TEST(TargetParserTest, testAArch64CPUArchList) {
bool testAArch64Arch(StringRef Arch, StringRef DefaultCPU, StringRef SubArch,
unsigned ArchAttr) {
AArch64::ArchKind AK = AArch64::parseArch(Arch);
- return (AK != AArch64::ArchKind::INVALID) &
- AArch64::getDefaultCPU(Arch).equals(DefaultCPU) &
- AArch64::getSubArch(AK).equals(SubArch) &
+ return (AK != AArch64::ArchKind::INVALID) &&
+ AArch64::getDefaultCPU(Arch).equals(DefaultCPU) &&
+ AArch64::getSubArch(AK).equals(SubArch) &&
(AArch64::getArchAttr(AK) == ArchAttr);
}
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index c1a3a34d928b..ebb4a31d86f4 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -1612,8 +1612,10 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N,
unsigned OResNo = 0;
TreePatternNode *OtherNode =
getOperandNum(x.SDTCisSameAs_Info.OtherOperandNum, N, NodeInfo, OResNo);
- return NodeToApply->UpdateNodeType(ResNo, OtherNode->getExtType(OResNo),TP)|
- OtherNode->UpdateNodeType(OResNo,NodeToApply->getExtType(ResNo),TP);
+ return (int)NodeToApply->UpdateNodeType(ResNo,
+ OtherNode->getExtType(OResNo), TP) |
+ (int)OtherNode->UpdateNodeType(OResNo,
+ NodeToApply->getExtType(ResNo), TP);
}
case SDTCisVTSmallerThanOp: {
// The NodeToApply must be a leaf node that is a VT. OtherOperandNum must
More information about the llvm-commits
mailing list