[clang] 7da0879 - [clang][dataflow][NFC] Fix reachability warning.

Yitzhak Mandelbaum via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 14 12:35:28 PDT 2022


Author: Yitzhak Mandelbaum
Date: 2022-10-14T19:35:11Z
New Revision: 7da087974f9491855eea0087c657851a84c67b75

URL: https://github.com/llvm/llvm-project/commit/7da087974f9491855eea0087c657851a84c67b75
DIFF: https://github.com/llvm/llvm-project/commit/7da087974f9491855eea0087c657851a84c67b75.diff

LOG: [clang][dataflow][NFC] Fix reachability warning.

Some compilers can't determine that all cases of the switch return (or are
unreachable) and warn about control reaching end of non-void
function. Explicitly mark with `llvm_unreachable`.

Differential Revision: https://reviews.llvm.org/D135978

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/FlowSensitive/Transfer.cpp b/clang/lib/Analysis/FlowSensitive/Transfer.cpp
index 4aa297d8e26a6..55510f486163c 100644
--- a/clang/lib/Analysis/FlowSensitive/Transfer.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Transfer.cpp
@@ -104,6 +104,7 @@ static BoolValue &unpackValue(BoolValue &V, Environment &Env) {
     return unpackBinaryBoolValue<BiconditionalValue>(Env, V,
                                                      &Environment::makeIff);
   }
+  llvm_unreachable("All reachable cases in switch return");
 }
 
 // Unpacks the value (if any) associated with `E` and updates `E` to the new


        


More information about the cfe-commits mailing list