[clang-tools-extra] [clang-tidy][NFC]clean ConstCorrectnessCheck (PR #130493)
Carlos Galvez via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 11 02:12:05 PDT 2025
================
@@ -136,16 +136,14 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) {
return;
VariableCategory VC = VariableCategory::Value;
- if (Variable->getType()->isReferenceType())
+ const QualType VT = Variable->getType();
+ if (VT->isReferenceType())
VC = VariableCategory::Reference;
- if (Variable->getType()->isPointerType())
+ else if (VT->isPointerType())
VC = VariableCategory::Pointer;
- if (Variable->getType()->isArrayType()) {
- if (const auto *ArrayT = dyn_cast<ArrayType>(Variable->getType())) {
- if (ArrayT->getElementType()->isPointerType())
- VC = VariableCategory::Pointer;
- }
- }
+ else if (const auto *ArrayT = dyn_cast<ArrayType>(VT))
----------------
carlosgalvezp wrote:
Is this allowed by out current guidelines? This `else if` blocks contains 2 lines. I think this is rather fragile and can easily break in the future.
https://github.com/llvm/llvm-project/pull/130493
More information about the cfe-commits
mailing list