21
21
#include " gmock/gmock.h"
22
22
#include " gtest/gtest.h"
23
23
24
+ namespace llvm {
25
+ namespace memprof {
24
26
namespace {
25
- using namespace llvm ;
26
- using namespace llvm ::memprof;
27
27
using testing::Contains;
28
28
using testing::ElementsAre;
29
29
using testing::Pair;
@@ -315,15 +315,12 @@ MemInfoBlock makePartialMIB() {
315
315
}
316
316
317
317
IndexedMemProfRecord
318
- makeRecordV2 (std::initializer_list<::llvm::memprof::CallStackId> AllocFrames,
319
- std::initializer_list<::llvm::memprof::CallStackId> CallSiteFrames,
320
- const MemInfoBlock &Block, const memprof::MemProfSchema &Schema) {
321
- llvm::memprof::IndexedMemProfRecord MR;
322
- for (const auto &CSId : AllocFrames) {
323
- // We don't populate IndexedAllocationInfo::CallStack because we use it only
324
- // in Version1.
318
+ makeRecordV2 (std::initializer_list<CallStackId> AllocFrames,
319
+ std::initializer_list<CallStackId> CallSiteFrames,
320
+ const MemInfoBlock &Block, const MemProfSchema &Schema) {
321
+ IndexedMemProfRecord MR;
322
+ for (const auto &CSId : AllocFrames)
325
323
MR.AllocSites .emplace_back (CSId, Block, Schema);
326
- }
327
324
for (const auto &CSId : CallSiteFrames)
328
325
MR.CallSiteIds .push_back (CSId);
329
326
return MR;
@@ -427,17 +424,17 @@ attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "t
427
424
428
425
const MemInfoBlock MIB = makePartialMIB ();
429
426
430
- Writer.setMemProfVersionRequested (memprof:: Version3);
427
+ Writer.setMemProfVersionRequested (Version3);
431
428
Writer.setMemProfFullSchema (false );
432
429
433
430
ASSERT_THAT_ERROR (Writer.mergeProfileKind (InstrProfKind::MemProf),
434
431
Succeeded ());
435
432
436
433
const IndexedMemProfRecord IndexedMR = makeRecordV2 (
437
434
/* AllocFrames=*/ {0x111 , 0x222 , 0x333 },
438
- /* CallSiteFrames=*/ {}, MIB, memprof:: getHotColdSchema ());
435
+ /* CallSiteFrames=*/ {}, MIB, getHotColdSchema ());
439
436
440
- memprof:: IndexedMemProfData MemProfData;
437
+ IndexedMemProfData MemProfData;
441
438
// The call sites within foo.
442
439
MemProfData.Frames .try_emplace (0 , GUIDFoo, 1 , 8 , false );
443
440
MemProfData.Frames .try_emplace (1 , GUIDFoo, 2 , 3 , false );
@@ -447,14 +444,11 @@ attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "t
447
444
MemProfData.Frames .try_emplace (4 , GUIDZzz, 9 , 9 , false );
448
445
MemProfData.Frames .try_emplace (5 , GUIDBaz, 9 , 9 , false );
449
446
MemProfData.CallStacks .try_emplace (
450
- 0x111 ,
451
- std::initializer_list<memprof::FrameId>{3 , 0 }); // bar called by foo
447
+ 0x111 , std::initializer_list<FrameId>{3 , 0 }); // bar called by foo
452
448
MemProfData.CallStacks .try_emplace (
453
- 0x222 ,
454
- std::initializer_list<memprof::FrameId>{4 , 1 }); // zzz called by foo
449
+ 0x222 , std::initializer_list<FrameId>{4 , 1 }); // zzz called by foo
455
450
MemProfData.CallStacks .try_emplace (
456
- 0x333 ,
457
- std::initializer_list<memprof::FrameId>{5 , 2 }); // baz called by foo
451
+ 0x333 , std::initializer_list<FrameId>{5 , 2 }); // baz called by foo
458
452
MemProfData.Records .try_emplace (0x9999 , IndexedMR);
459
453
Writer.addMemProfData (MemProfData, Err);
460
454
@@ -488,3 +482,5 @@ attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "t
488
482
Pair (LineLocation (3 , 3 ), LineLocation (2 , 8 ))))));
489
483
}
490
484
} // namespace
485
+ } // namespace memprof
486
+ } // namespace llvm
0 commit comments