[clang] [clang][dataflow] Add synthetic fields to `RecordStorageLocation` (PR #73860)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 30 11:54:30 PST 2023


================
@@ -88,12 +94,12 @@ class ScalarStorageLocation final : public StorageLocation {
 class RecordStorageLocation final : public StorageLocation {
 public:
   using FieldToLoc = llvm::DenseMap<const ValueDecl *, StorageLocation *>;
+  using SyntheticFieldMap = llvm::StringMap<StorageLocation *>;
----------------
Xazax-hun wrote:

I was wondering, if we want this map to **not** be indexed by strings. An alternative would be to somehow access the `IdentifierTable` and create an identifier from the names and use the pointer to the identifier as the key. This has the potential to be a bit lighter on memory (identifiers only stored once as opposed to storing the keys in each RecordStorageLocation instance), and potentially a bit quicker lookup. 

That being said, I am not insisting on the change, and even if we want to do it, it is probably OK in a follow-up PR. 

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


More information about the cfe-commits mailing list