[PATCH] D63671: [llvm-profdata] [NFC] Avoir keeping reference to every files
Wei Mi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 15:59:27 PDT 2019
wmi added a comment.
We had better have a test for it. It is not a strict NFC and we best verify it works as we expect -- like if we miss any place which still uses StringRef refering to string in file data buffer, we may have dangling pointer after we free the buffer.
================
Comment at: llvm/tools/llvm-profdata/llvm-profdata.cpp:444
StringMap<FunctionSamples> ProfileMap;
- SmallVector<std::unique_ptr<sampleprof::SampleProfileReader>, 5> Readers;
+ StringSet<> FunctionNames;
LLVMContext Context;
----------------
Please add some comment about why we need FunctionNames. I think it is because FunctionSamples and SampleRecord all use StringRef and the original strings refered to are in the data buffer. To remove the dependence on the data buffer, we want to use a name table to save all the name strings. The usage is not very straightforward.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63671/new/
https://reviews.llvm.org/D63671
More information about the llvm-commits
mailing list