[clang] [analyzer] Check the correct first and last elements in cstring.UninitializedRead (PR #95408)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 13 08:21:08 PDT 2024


================
@@ -171,6 +174,17 @@ class MemRegion : public llvm::FoldingSetNode {
 
   Kind getKind() const { return kind; }
 
+  StringRef getKindStr() const {
+    switch (getKind()) {
+#define REGION(Id, Parent)                                                     \
+  case Id##Kind:                                                               \
+    return #Id;
+#include "clang/StaticAnalyzer/Core/PathSensitive/Regions.def"
+#undef REGION
+    }
+    llvm_unreachable("Unkown kind!");
----------------
steakhal wrote:

Do we need this? To me the switch is complete, and if it wasn't, we would get a switch warning here anyways.

https://github.com/llvm/llvm-project/pull/95408


More information about the cfe-commits mailing list