llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-tidy Author: Congcong Cai (HerrCai0907) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/130493.diff 1 Files Affected: - (modified) clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp (+6-8) ``````````diff diff --git a/clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp b/clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp index 6e412e576e5f9..dbe59233df699 100644 --- a/clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp +++ b/clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp @@ -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)) + if (ArrayT->getElementType()->isPointerType()) + VC = VariableCategory::Pointer; // Each variable can only be in one category: Value, Pointer, Reference. // Analysis can be controlled for every category. `````````` </details> https://github.com/llvm/llvm-project/pull/130493 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits