[clang] [analyzer] Variant checker bindings (PR #87886)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 8 09:10:47 PDT 2024


================
@@ -206,23 +221,42 @@ class StdVariantChecker : public Checker<eval::Call, check::RegionChanges> {
     if (!ThisMemRegion)
       return;
 
+    // Get the first type alternative of the std::variant instance.
+    assert((ThisSVal.getType(C.getASTContext())->isPointerType() ||
+            ThisSVal.getType(C.getASTContext())->isReferenceType()) &&
+           "The This SVal must be a pointer!");
----------------
NagyDonat wrote:

```suggestion
           "The SVal representation of 'this' must be a pointer!");
```
Instead of capitalizing `this` (which deviates from its canonical style), use apostrophes to clarify that you're using it as the C++ keyword.

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


More information about the cfe-commits mailing list