Skip to content

Commit cf55439

Browse files
committed
[clang-tidy][NFC]clean ConstCorrectnessCheck
1 parent d84dc8f commit cf55439

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,14 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) {
136136
return;
137137

138138
VariableCategory VC = VariableCategory::Value;
139-
if (Variable->getType()->isReferenceType())
139+
const QualType VT = Variable->getType();
140+
if (VT->isReferenceType())
140141
VC = VariableCategory::Reference;
141-
if (Variable->getType()->isPointerType())
142+
else if (VT->isPointerType())
142143
VC = VariableCategory::Pointer;
143-
if (Variable->getType()->isArrayType()) {
144-
if (const auto *ArrayT = dyn_cast<ArrayType>(Variable->getType())) {
145-
if (ArrayT->getElementType()->isPointerType())
146-
VC = VariableCategory::Pointer;
147-
}
148-
}
144+
else if (const auto *ArrayT = dyn_cast<ArrayType>(VT))
145+
if (ArrayT->getElementType()->isPointerType())
146+
VC = VariableCategory::Pointer;
149147

150148
// Each variable can only be in one category: Value, Pointer, Reference.
151149
// Analysis can be controlled for every category.

0 commit comments

Comments
 (0)