================
@@ -1441,6 +1531,9 @@ void OverlapStats::dump(raw_fd_ostream &OS) const {
case IPVK_MemOPSize:
strncpy(ProfileKindName, "MemOP", 19);
break;
+ case IPVK_VTableTarget:
+ strncpy(ProfileKindName, "VTable", 6);
----------------
minglotus-6 wrote:
thanks for the catch! I updated this to `strncpy(ProfileKindName, "VTable",
19);`.
Updated the initializer to `ProfileKindName[20] = {0}` to make it clearer.
- C string literals are [null
terminated](https://softwareengineering.stackexchange.com/questions/344603/are-c-strings-always-null-terminated-or-does-it-depend-on-the-platform),
and `strncpy` will [pad destination will zeros if the end of source is
seen](https://cplusplus.com/reference/cstring/strncpy/) before 19 chars are
copied here.
I just realized '19' is chosen as 'sizeof(ProfileKindName) - 1' with this
comment.
https://github.com/llvm/llvm-project/pull/66825
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits