[clang] 40c50bd - [Sema][NFC] Remove Redundant Condition
Adam Balogh via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 1 00:02:19 PDT 2020
Author: Adam Balogh
Date: 2020-07-01T09:04:27+02:00
New Revision: 40c50bdee443dd48424ac7d724ced8874c40ee33
URL: https://github.com/llvm/llvm-project/commit/40c50bdee443dd48424ac7d724ced8874c40ee33
DIFF: https://github.com/llvm/llvm-project/commit/40c50bdee443dd48424ac7d724ced8874c40ee33.diff
LOG: [Sema][NFC] Remove Redundant Condition
Condition `TypeQuals` is checked both in an outer and in an inner `if`
statement in static function `ConvertDeclSpecToType()` in file
`SemaType.cpp`. This patch removes the redundant inner check.
The issue was found using `clang-tidy` check under review
`misc-redundant-condition`. See https://reviews.llvm.org/D81272.
Differential Revision: https://reviews.llvm.org/D82563
Added:
Modified:
clang/lib/Sema/SemaType.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 52fe292ce113..b8a787f010d6 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -1759,7 +1759,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) {
// The effect of a cv-qualifier-seq in a function declarator is not the
// same as adding cv-qualification on top of the function type. In the
// latter case, the cv-qualifiers are ignored.
- if (TypeQuals && Result->isFunctionType()) {
+ if (Result->isFunctionType()) {
diagnoseAndRemoveTypeQualifiers(
S, DS, TypeQuals, Result, DeclSpec::TQ_const | DeclSpec::TQ_volatile,
S.getLangOpts().CPlusPlus
More information about the cfe-commits
mailing list