[clang] 8c0acbf - [clang][dataflow] Avoid -Wunused-variable.

Martin Braenne via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 28 00:58:58 PDT 2023


Author: Martin Braenne
Date: 2023-07-28T07:57:50Z
New Revision: 8c0acbf8370f29943798cd434cd0b91bbd554cdf

URL: https://github.com/llvm/llvm-project/commit/8c0acbf8370f29943798cd434cd0b91bbd554cdf
DIFF: https://github.com/llvm/llvm-project/commit/8c0acbf8370f29943798cd434cd0b91bbd554cdf.diff

LOG: [clang][dataflow] Avoid -Wunused-variable.

Added: 
    

Modified: 
    clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
index 903d9ec300e2f6..214e0c061ed7bc 100644
--- a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -686,9 +686,11 @@ void Environment::setValueStrict(const Expr &E, Value &Val) {
   assert(E.isPRValue());
 
   if (auto *StructVal = dyn_cast<StructValue>(&Val)) {
-    if (auto *ExistingVal = cast_or_null<StructValue>(getValue(E)))
+    if ([[maybe_unused]] auto *ExistingVal =
+            cast_or_null<StructValue>(getValue(E)))
       assert(&ExistingVal->getAggregateLoc() == &StructVal->getAggregateLoc());
-    if (StorageLocation *ExistingLoc = getStorageLocation(E, SkipPast::None))
+    if ([[maybe_unused]] StorageLocation *ExistingLoc =
+            getStorageLocation(E, SkipPast::None))
       assert(ExistingLoc == &StructVal->getAggregateLoc());
     else
       setStorageLocation(E, StructVal->getAggregateLoc());


        


More information about the cfe-commits mailing list