@@ -76,18 +76,18 @@ bool compileFromString(StringRef Code, StringRef Standard, StringRef File,
76
76
}
77
77
78
78
std::string GetMetadata (json::Object *Event) {
79
- std::string Metadata ;
80
- llvm::raw_string_ostream OS (Metadata );
79
+ std::string M ;
80
+ llvm::raw_string_ostream OS (M );
81
81
if (json::Object *Args = Event->getObject (" args" )) {
82
82
if (auto Detail = Args->getString (" detail" ))
83
83
OS << Detail;
84
84
// Use only filename to not include os-specific path separators.
85
85
if (auto File = Args->getString (" file" ))
86
- OS << " , " << llvm::sys::path::filename (*File);
86
+ OS << (M. empty () ? " " : " , " ) << llvm::sys::path::filename (*File);
87
87
if (auto Line = Args->getInteger (" line" ))
88
88
OS << " :" << *Line;
89
89
}
90
- return Metadata ;
90
+ return M ;
91
91
}
92
92
93
93
// Returns pretty-printed trace graph.
@@ -209,7 +209,7 @@ constexpr int slow_init_list[] = {1, 1, 2, 3, 5, 8, 13, 21}; // 25th line
209
209
ASSERT_TRUE (compileFromString (Code, " -std=c++20" , " test.cc" ));
210
210
std::string Json = teardownProfiler ();
211
211
ASSERT_EQ (R"(
212
- Frontend
212
+ Frontend (test.cc)
213
213
| ParseDeclarationOrFunctionDefinition (test.cc:2:1)
214
214
| ParseDeclarationOrFunctionDefinition (test.cc:6:1)
215
215
| | ParseFunctionDefinition (slow_func)
@@ -266,7 +266,7 @@ TEST(TimeProfilerTest, TemplateInstantiations) {
266
266
/* Headers=*/ {{" a.h" , A_H}, {" b.h" , B_H}}));
267
267
std::string Json = teardownProfiler ();
268
268
ASSERT_EQ (R"(
269
- Frontend
269
+ Frontend (test.cc)
270
270
| ParseFunctionDefinition (fooB)
271
271
| ParseFunctionDefinition (fooMTA)
272
272
| ParseFunctionDefinition (fooA)
@@ -291,7 +291,7 @@ struct {
291
291
ASSERT_TRUE (compileFromString (Code, " -std=c99" , " test.c" ));
292
292
std::string Json = teardownProfiler ();
293
293
ASSERT_EQ (R"(
294
- Frontend
294
+ Frontend (test.c)
295
295
| ParseDeclarationOrFunctionDefinition (test.c:2:1)
296
296
| | isIntegerConstantExpr (<test.c:3:18>)
297
297
| | EvaluateKnownConstIntCheckOverflow (<test.c:3:18>)
0 commit comments