mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 16:56:35 +00:00
[clang-tidy][NFC]clean ConstCorrectnessCheck (#130493)
This commit is contained in:
parent
318bef91ea
commit
5cfc37b345
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user