[PATCH] D155457: [clang] Skip tautological comparison if the comparison involves the 'size_t' type
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 27 01:26:04 PDT 2023
cor3ntin added inline comments.
================
Comment at: clang/lib/Sema/SemaChecking.cpp:13807-13815
+ // Don't warn if the comparison involves integral or floating-point types with
+ // the same canonical types.
+ QualType LHSCanonical = Constant->getType().getCanonicalType();
+ QualType RHSCanonical = Other->getType().getCanonicalType();
+ if ((LHSCanonical->isIntegralOrEnumerationType() ||
+ LHSCanonical->isFloatingType()) &&
+ S.Context.hasSameType(LHSCanonical, RHSCanonical)) {
----------------
This is what I had in mind. I haven't tested it though
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155457/new/
https://reviews.llvm.org/D155457
More information about the cfe-commits
mailing list