@@ -34,7 +34,7 @@ TimeTraceProfiler* timeTraceProfiler = null;
34
34
* timeGranularityUs = minimum event size in microseconds
35
35
* processName = name of this executable
36
36
*/
37
- extern (C++ )
37
+ extern (C++ , " dmd " )
38
38
void initializeTimeTrace (uint timeGranularityUs, const (char )* processName)
39
39
{
40
40
assert (timeTraceProfiler is null , " Double initialization of timeTraceProfiler" );
@@ -46,7 +46,7 @@ void initializeTimeTrace(uint timeGranularityUs, const(char)* processName)
46
46
*
47
47
* After this, no more calls to timeTrace functions can be made.
48
48
*/
49
- extern (C++ )
49
+ extern (C++ , " dmd " )
50
50
void deinitializeTimeTrace ()
51
51
{
52
52
if (timeTraceProfilerEnabled())
@@ -60,7 +60,7 @@ void deinitializeTimeTrace()
60
60
* Returns: Whether time tracing is enabled.
61
61
*/
62
62
pragma (inline, true )
63
- extern (C++ )
63
+ extern (C++ , " dmd " )
64
64
bool timeTraceProfilerEnabled ()
65
65
{
66
66
version (LDC )
@@ -80,7 +80,7 @@ bool timeTraceProfilerEnabled()
80
80
* Params:
81
81
* buf = output buffer to write JSON into
82
82
*/
83
- extern (C++ )
83
+ extern (C++ , " dmd " )
84
84
void writeTimeTraceProfile (OutBuffer * buf)
85
85
{
86
86
timeTraceProfiler.writeToBuffer(* buf);
@@ -94,7 +94,7 @@ void writeTimeTraceProfile(OutBuffer* buf)
94
94
* detail_ptr = further details, visible when this event is selected
95
95
* loc = source location corresponding to this event
96
96
*/
97
- extern (C++ )
97
+ extern (C++ , " dmd " )
98
98
void timeTraceBeginEvent (scope const (char )* name_ptr, scope const (char )* detail_ptr, Loc loc)
99
99
{
100
100
import dmd.root.rmem : xarraydup;
@@ -117,7 +117,7 @@ void timeTraceBeginEvent(scope const(char)* name_ptr, scope const(char)* detail_
117
117
* eventType = what compilation stage the event belongs to
118
118
* (redundant with the eventType of `timeTraceEndEvent` but used by GDC)
119
119
*/
120
- extern (C++ )
120
+ extern (C++ , " dmd " )
121
121
void timeTraceBeginEvent (TimeTraceEventType eventType)
122
122
{
123
123
if (timeTraceProfilerEnabled)
@@ -135,7 +135,7 @@ void timeTraceBeginEvent(TimeTraceEventType eventType)
135
135
* e = Expression which was analyzed, used to generate 'name' and 'detail'
136
136
* detail = custom lazy string for 'detail' of event
137
137
*/
138
- extern (C++ )
138
+ extern (C++ , " dmd " )
139
139
void timeTraceEndEvent (TimeTraceEventType eventType)
140
140
{
141
141
if (timeTraceProfilerEnabled)
@@ -157,14 +157,27 @@ void timeTraceEndEvent(TimeTraceEventType eventType, Dsymbol sym, scope const(ch
157
157
}
158
158
159
159
// / ditto
160
- extern (C++ )
160
+ extern (C++ , " dmd " )
161
161
void timeTraceEndEvent (TimeTraceEventType eventType, Expression e)
162
162
{
163
163
if (timeTraceProfilerEnabled)
164
164
timeTraceProfiler.endScope(eventType, () => e.toChars().toDString(),
165
165
() => e.toChars().toDString(), e.loc);
166
166
}
167
167
168
+ version (IN_LLVM)
169
+ {
170
+ import dmd.func : FuncDeclaration;
171
+
172
+ extern (C++ , " dmd" )
173
+ void timeTraceEndEvent (TimeTraceEventType eventType, FuncDeclaration fd)
174
+ {
175
+ if (timeTraceProfilerEnabled)
176
+ timeTraceProfiler.endScope(eventType, () => fd.toChars().toDString(),
177
+ () => fd.toPrettyChars().toDString(), fd.loc);
178
+ }
179
+ }
180
+
168
181
// / Identifies which compilation stage the event is associated to
169
182
enum TimeTraceEventType
170
183
{
0 commit comments