[PATCH] D82563: [Sema][NFC] Remove Redundant Condition

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 25 08:34:21 PDT 2020


baloghadamsoftware created this revision.
baloghadamsoftware added reviewers: sammccall, rsmith.
baloghadamsoftware added a project: clang.
Herald added subscribers: martong, gamesh411, Szelethus, dkrupp, rnkovacs.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82563

Files:
  clang/lib/Sema/SemaType.cpp


Index: clang/lib/Sema/SemaType.cpp
===================================================================
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -1759,7 +1759,7 @@
     //   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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82563.273369.patch
Type: text/x-patch
Size: 645 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200625/d982fcd8/attachment.bin>


More information about the cfe-commits mailing list