[compiler-rt] [clang] [clang-tools-extra] [PGO] Exposing PGO's Counter Reset and File Dumping APIs (PR #76471)
Teresa Johnson via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 27 13:29:57 PST 2023
teresajohnson wrote:
The way we have done this in the past is to declare these as weak symbols and check if they exist before calling. E.g.:
```
extern "C" __attribute__((weak)) int __llvm_profile_dump(void);
if (__llvm_profile_dump)
if (__llvm_profile_dump() != 0) { ...
```
Not necessarily opposed to adding the macros etc, but the advantage of the weak symbol approach vs what you have here is that the user code can check the return values.
https://github.com/llvm/llvm-project/pull/76471
More information about the cfe-commits
mailing list