[clang] [clang-tools-extra] [compiler-rt] [PGO] Exposing PGO's Counter Reset and File Dumping APIs (PR #76471)

Snehasish Kumar via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 28 14:10:27 PST 2023


================
@@ -12,6 +12,19 @@
 #include "InstrProfilingPort.h"
 #include <stdio.h>
 
+// Make sure __LLVM_INSTR_PROFILE_GENERATE is always defined before
+// including instr_prof_interface.h so the interface functions are
+// declared correctly for the runtime. Additionally, make sure
+// that __LLVM_INSTR_PROFILE_GENERATE is undefined only when it is
+// not explicitly defined somewhere else.
+#ifndef __LLVM_INSTR_PROFILE_GENERATE
+#define __LLVM_INSTR_PROFILE_GENERATE
+#include "profile/instr_prof_interface.h"
+#undef __LLVM_INSTR_PROFILE_GENERATE
+#else
----------------
snehasish wrote:

Is this `else` for the case where compiler-rt itself is instrumented? I don't think we support this. 

https://github.com/llvm/llvm-project/pull/76471


More information about the cfe-commits mailing list