[PATCH] D95629: [clang][analyzer] Own string keys in AnalyzerOptions::ConfigTable

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 29 00:56:33 PST 2021


jansvoboda11 added a comment.

In D95629#2528931 <https://reviews.llvm.org/D95629#2528931>, @dexonsmith wrote:

> I think this patch can be skipped. `StringMap` owns its own strings. `StringMapEntry` uses tail allocation to include a null-terminated string inline. For details, have a look at `StringMapEntry::Create` in llvm/ADT/StringMapEntry.h.

You're right.

I first discovered lifetime issues with `Config` when using a non-stable data structure for holding allocated strings. Reading the documentation and looking at the API of `StringMap` made me believe the keys are not owned and I forgot to double-check.

Closing this, as D95369 <https://reviews.llvm.org/D95369> works correctly regardless.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95629



More information about the cfe-commits mailing list