|
2 | 2 |
|
3 | 3 | #include "../Common/CommandLine.h"
|
4 | 4 | #include "../Common/Context.h"
|
| 5 | +#include "../Common/CRC64.h" |
5 | 6 | #include "../Common/DirectoryUtils.h"
|
6 | 7 | #include "../Common/JsonParser.h"
|
7 | 8 | #include "../Common/IOStream.h"
|
@@ -262,11 +263,35 @@ namespace Clang
|
262 | 263 | return phase;
|
263 | 264 | }
|
264 | 265 |
|
| 266 | + // ----------------------------------------------------------------------------------------------------------- |
| 267 | + U8 GetTrack( const CompileEvent& compileEvent ) |
| 268 | + { |
| 269 | + //Move some events to a different track |
| 270 | + |
| 271 | + enum AlternativeTrackNames : U64 |
| 272 | + { |
| 273 | + ParseDeclaration = Hash::CreateCompileTimeCRC64( "ParseDeclarationOrFunctionDefinition" ), |
| 274 | + ParseFunction = Hash::CreateCompileTimeCRC64( "ParseFunctionDefinition" ), |
| 275 | + }; |
| 276 | + |
| 277 | + if( compileEvent.category == CompileCategory::Other && ( compileEvent.nameHash == ParseDeclaration || compileEvent.nameHash == ParseFunction ) ) |
| 278 | + { |
| 279 | + return 1u; |
| 280 | + } |
| 281 | + |
| 282 | + return 0u; |
| 283 | + } |
| 284 | + |
265 | 285 | // -----------------------------------------------------------------------------------------------------------
|
266 | 286 | void AddEventToTimeline(ScoreTimeline& timeline, const CompileEvent& compileEvent)
|
267 | 287 | {
|
| 288 | + const U8 track = GetTrack(compileEvent); |
| 289 | + |
| 290 | + //Make sure we have the track ready for this upcoming event |
| 291 | + while( track >= timeline.tracks.size() ) { timeline.tracks.emplace_back(); } |
| 292 | + |
268 | 293 | //inject in a sorted position
|
269 |
| - TCompileEvents& events = timeline.tracks[0]; |
| 294 | + TCompileEvents& events = timeline.tracks[ track ]; |
270 | 295 | TCompileEvents::iterator found = fastl::lower_bound(events.begin(),events.end(),compileEvent,
|
271 | 296 | [=](const CompileEvent& input, const CompileEvent& value)
|
272 | 297 | {
|
@@ -332,7 +357,6 @@ namespace Clang
|
332 | 357 | CompileUnitContext context;
|
333 | 358 |
|
334 | 359 | ScoreTimeline timeline;
|
335 |
| - timeline.tracks.emplace_back(); //we only use one events track in Clang |
336 | 360 |
|
337 | 361 | fastl::string inputPath{path};
|
338 | 362 | StringUtils::NormalizePath(inputPath);
|
|
0 commit comments