[PATCH] D131707: [analyzer][NFC] Cache the result of getLocationType in TypedValueRegion

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 15 04:24:14 PDT 2022


steakhal added a comment.

Please measure the performance implications/gains of this patch to justify this change.
Preferably test it on multiple kinds of projects ranging from old-school C and even some modern C++ projects.
Let me know your findings and if you need some help setting it up.



================
Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h:549-550
+      CachedLocationType = T->isObjCObjectType() ? C.getObjCObjectPointerType(T)
+                                                 : C.getPointerType(T);
+    }
+    return CachedLocationType;
----------------
I would appreciate it if you assert that the resulting type cannot be `null`, which would imply that if `CachedLocationType.isNull()` means that we haven't cached it yet.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131707/new/

https://reviews.llvm.org/D131707



More information about the cfe-commits mailing list