[PATCH] D119268: avoid the warning of assignment operation inside the if statement

Shivam Rajput via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 8 11:17:58 PST 2022

phyBrackets created this revision.
Herald added a subscriber: martong.
phyBrackets requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

  rG LLVM Github Monorepo



Index: clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
--- clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -946,7 +946,7 @@
   // FIXME: This is a simplified version of what's in CFRefCount.cpp -- it makes
   // some assumptions about the value that CFRefCount can't. Even so, it should
   // probably be refactored.
-  if (Optional<loc::MemRegionVal> MR = L->getAs<loc::MemRegionVal>()) {
+  if ((Optional<loc::MemRegionVal> MR = L->getAs<loc::MemRegionVal>())) {
     const MemRegion *R = MR->getRegion()->StripCasts();
     // Are we dealing with an ElementRegion?  If so, we should be invalidating

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119268.406903.patch
Type: text/x-patch
Size: 742 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220208/088fecd3/attachment.bin>

More information about the cfe-commits mailing list