This is an archive of the discontinued LLVM Phabricator instance.

[memprof] Respect COMPILER_RT_BUILD_MEMPROF when install memprof headers
ClosedPublic

Authored by Enna1 on Oct 23 2022, 5:16 AM.

Details

Summary

When COMPILER_RT_BUILD_MEMPROF is disabled, the memprof headers should not be installed.

Diff Detail

Event Timeline

Enna1 created this revision.Oct 23 2022, 5:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 23 2022, 5:16 AM
Enna1 published this revision for review.EditedOct 23 2022, 5:28 AM
Enna1 added reviewers: mgorny, tejohnson.
Enna1 added a subscriber: MTC.

Actually, MEMPROF_HEADERS is set when COMPILER_RT_BUILD_MEMPROF is enabled.
If we use install(FILES ${MEMPROF_HEADERS}, the interface header won't be install when COMPILER_RT_BUILD_MEMPROF is disabled.
But we decide to only install sanitizer/memprof_interface.h and not to install MemProfData.inc, so here we guard the installation of sanitizer/memprof_interface.h with COMPILER_RT_BUILD_MEMPROF.
Could can set MEMPROF_HEADERS only including sanitizer/memprof_interface.h?

Herald added a project: Restricted Project. · View Herald TranscriptOct 23 2022, 5:28 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript

Other sanitizers are using *_HEADERS vars for this. I see that MEMPROF_HEADERS also includes MemProfData.inc — is this something that could be potentially useful being installed?

Enna1 added a comment.Oct 23 2022, 5:42 AM

As @tejohnson mentioned in https://reviews.llvm.org/D136067, MemProfData.inc won't be called by user code, that's why we think only installing the interface header is enough for now.
Let's wait for tejohnson's option about this change.

tejohnson accepted this revision.Oct 24 2022, 8:22 AM

As @tejohnson mentioned in https://reviews.llvm.org/D136067, MemProfData.inc won't be called by user code, that's why we think only installing the interface header is enough for now.
Let's wait for tejohnson's option about this change.

Yeah it is unfortunate that we need to structure the code here a bit differently than the other headers, but I'm not sure the implications of putting MemProfData.inc into a different install directory than the directory it comes from. In the other cases the headers all come out of the same subdirectory. And I don't think it should be needed in any case.

So lgtm for this fix.

This revision is now accepted and ready to land.Oct 24 2022, 8:22 AM
mgorny accepted this revision.Oct 24 2022, 9:18 AM

Thanks. LGTM to me too (and I've confirmed that it works).