forked from OSchip/llvm-project
[XRay] Rename Buffer.Buffer to Buffer.Data
Summary: some compiler (msvc) treats Buffer.Buffer as constructor and refuse to compile. NFC Authored by comicfans44. Reviewers: rnk, dberris Reviewed By: dberris Subscribers: llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40346 llvm-svn: 324807
This commit is contained in:
parent
b8d7b1620b
commit
ec81ae37bd
|
@ -32,9 +32,9 @@ TEST(BufferQueueTest, GetAndRelease) {
|
|||
ASSERT_TRUE(Success);
|
||||
BufferQueue::Buffer Buf;
|
||||
ASSERT_EQ(Buffers.getBuffer(Buf), BufferQueue::ErrorCode::Ok);
|
||||
ASSERT_NE(nullptr, Buf.Buffer);
|
||||
ASSERT_NE(nullptr, Buf.Data);
|
||||
ASSERT_EQ(Buffers.releaseBuffer(Buf), BufferQueue::ErrorCode::Ok);
|
||||
ASSERT_EQ(nullptr, Buf.Buffer);
|
||||
ASSERT_EQ(nullptr, Buf.Data);
|
||||
}
|
||||
|
||||
TEST(BufferQueueTest, GetUntilFailed) {
|
||||
|
@ -53,7 +53,7 @@ TEST(BufferQueueTest, ReleaseUnknown) {
|
|||
BufferQueue Buffers(kSize, 1, Success);
|
||||
ASSERT_TRUE(Success);
|
||||
BufferQueue::Buffer Buf;
|
||||
Buf.Buffer = reinterpret_cast<void *>(0xdeadbeef);
|
||||
Buf.Data = reinterpret_cast<void *>(0xdeadbeef);
|
||||
Buf.Size = kSize;
|
||||
EXPECT_EQ(BufferQueue::ErrorCode::UnrecognizedBuffer,
|
||||
Buffers.releaseBuffer(Buf));
|
||||
|
@ -65,7 +65,7 @@ TEST(BufferQueueTest, ErrorsWhenFinalising) {
|
|||
ASSERT_TRUE(Success);
|
||||
BufferQueue::Buffer Buf;
|
||||
ASSERT_EQ(Buffers.getBuffer(Buf), BufferQueue::ErrorCode::Ok);
|
||||
ASSERT_NE(nullptr, Buf.Buffer);
|
||||
ASSERT_NE(nullptr, Buf.Data);
|
||||
ASSERT_EQ(Buffers.finalize(), BufferQueue::ErrorCode::Ok);
|
||||
BufferQueue::Buffer OtherBuf;
|
||||
ASSERT_EQ(BufferQueue::ErrorCode::QueueFinalizing,
|
||||
|
|
|
@ -37,7 +37,7 @@ BufferQueue::BufferQueue(size_t B, size_t N, bool &Success)
|
|||
return;
|
||||
}
|
||||
auto &Buf = T.Buff;
|
||||
Buf.Buffer = Tmp;
|
||||
Buf.Data = Tmp;
|
||||
Buf.Size = B;
|
||||
Buf.Extents = reinterpret_cast<BufferExtents *>(Extents);
|
||||
OwnedBuffers[i] = Tmp;
|
||||
|
@ -68,7 +68,7 @@ BufferQueue::ErrorCode BufferQueue::releaseBuffer(Buffer &Buf) {
|
|||
// Blitz through the buffers array to find the buffer.
|
||||
bool Found = false;
|
||||
for (auto I = OwnedBuffers, E = OwnedBuffers + BufferCount; I != E; ++I) {
|
||||
if (*I == Buf.Buffer) {
|
||||
if (*I == Buf.Data) {
|
||||
Found = true;
|
||||
break;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ BufferQueue::ErrorCode BufferQueue::releaseBuffer(Buffer &Buf) {
|
|||
// Now that the buffer has been released, we mark it as "used".
|
||||
First->Buff = Buf;
|
||||
First->Used = true;
|
||||
Buf.Buffer = nullptr;
|
||||
Buf.Data = nullptr;
|
||||
Buf.Size = 0;
|
||||
--LiveBuffers;
|
||||
if (++First == (Buffers + BufferCount))
|
||||
|
@ -106,7 +106,7 @@ BufferQueue::~BufferQueue() {
|
|||
for (auto I = Buffers, E = Buffers + BufferCount; I != E; ++I) {
|
||||
auto &T = *I;
|
||||
auto &Buf = T.Buff;
|
||||
InternalFree(Buf.Buffer);
|
||||
InternalFree(Buf.Data);
|
||||
InternalFree(Buf.Extents);
|
||||
}
|
||||
delete[] Buffers;
|
||||
|
|
|
@ -33,7 +33,7 @@ class BufferQueue {
|
|||
};
|
||||
|
||||
struct Buffer {
|
||||
void *Buffer = nullptr;
|
||||
void *Data = nullptr;
|
||||
size_t Size = 0;
|
||||
BufferExtents* Extents;
|
||||
};
|
||||
|
|
|
@ -136,8 +136,8 @@ XRayLogFlushStatus fdrLoggingFlush() XRAY_NEVER_INSTRUMENT {
|
|||
retryingWriteAll(Fd, reinterpret_cast<char *>(&ExtentsRecord),
|
||||
reinterpret_cast<char *>(&ExtentsRecord) +
|
||||
sizeof(MetadataRecord));
|
||||
retryingWriteAll(Fd, reinterpret_cast<char *>(B.Buffer),
|
||||
reinterpret_cast<char *>(B.Buffer) + BufferExtents);
|
||||
retryingWriteAll(Fd, reinterpret_cast<char *>(B.Data),
|
||||
reinterpret_cast<char *>(B.Data) + BufferExtents);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -341,7 +341,7 @@ XRayLogInitStatus fdrLoggingInit(std::size_t BufferSize, std::size_t BufferMax,
|
|||
auto EC = TLD.BQ->releaseBuffer(TLD.Buffer);
|
||||
if (EC != BufferQueue::ErrorCode::Ok)
|
||||
Report("At thread exit, failed to release buffer at %p; error=%s\n",
|
||||
TLD.Buffer.Buffer, BufferQueue::getErrorString(EC));
|
||||
TLD.Buffer.Data, BufferQueue::getErrorString(EC));
|
||||
});
|
||||
return false;
|
||||
}();
|
||||
|
|
|
@ -235,7 +235,7 @@ inline void setupNewBuffer(int (*wall_clock_reader)(
|
|||
clockid_t, struct timespec *)) XRAY_NEVER_INSTRUMENT {
|
||||
auto &TLD = getThreadLocalData();
|
||||
auto &B = TLD.Buffer;
|
||||
TLD.RecordPtr = static_cast<char *>(B.Buffer);
|
||||
TLD.RecordPtr = static_cast<char *>(B.Data);
|
||||
pid_t Tid = syscall(SYS_gettid);
|
||||
timespec TS{0, 0};
|
||||
// This is typically clock_gettime, but callers have injection ability.
|
||||
|
@ -447,7 +447,7 @@ inline bool releaseThreadLocalBuffer(BufferQueue &BQArg) {
|
|||
auto &TLD = getThreadLocalData();
|
||||
auto EC = BQArg.releaseBuffer(TLD.Buffer);
|
||||
if (EC != BufferQueue::ErrorCode::Ok) {
|
||||
Report("Failed to release buffer at %p; error=%s\n", TLD.Buffer.Buffer,
|
||||
Report("Failed to release buffer at %p; error=%s\n", TLD.Buffer.Data,
|
||||
BufferQueue::getErrorString(EC));
|
||||
return false;
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ inline bool prepareBuffer(uint64_t TSC, unsigned char CPU,
|
|||
struct timespec *),
|
||||
size_t MaxSize) XRAY_NEVER_INSTRUMENT {
|
||||
auto &TLD = getThreadLocalData();
|
||||
char *BufferStart = static_cast<char *>(TLD.Buffer.Buffer);
|
||||
char *BufferStart = static_cast<char *>(TLD.Buffer.Data);
|
||||
if ((TLD.RecordPtr + MaxSize) > (BufferStart + TLD.Buffer.Size)) {
|
||||
if (!releaseThreadLocalBuffer(*TLD.BQ))
|
||||
return false;
|
||||
|
@ -507,7 +507,7 @@ isLogInitializedAndReady(BufferQueue *LBQ, uint64_t TSC, unsigned char CPU,
|
|||
TLD.RecordPtr = nullptr;
|
||||
}
|
||||
|
||||
if (TLD.Buffer.Buffer == nullptr) {
|
||||
if (TLD.Buffer.Data == nullptr) {
|
||||
auto EC = LBQ->getBuffer(TLD.Buffer);
|
||||
if (EC != BufferQueue::ErrorCode::Ok) {
|
||||
auto LS = __sanitizer::atomic_load(&LoggingStatus,
|
||||
|
@ -573,7 +573,7 @@ inline uint32_t writeCurrentCPUTSC(ThreadLocalData &TLD, uint64_t TSC,
|
|||
|
||||
inline void endBufferIfFull() XRAY_NEVER_INSTRUMENT {
|
||||
auto &TLD = getThreadLocalData();
|
||||
auto BufferStart = static_cast<char *>(TLD.Buffer.Buffer);
|
||||
auto BufferStart = static_cast<char *>(TLD.Buffer.Data);
|
||||
if ((TLD.RecordPtr + MetadataRecSize) - BufferStart <=
|
||||
ptrdiff_t{MetadataRecSize}) {
|
||||
if (!releaseThreadLocalBuffer(*TLD.BQ))
|
||||
|
@ -656,7 +656,7 @@ inline void processFunctionHook(int32_t FuncId, XRayEntryType Entry,
|
|||
}
|
||||
|
||||
// By this point, we are now ready to write up to 40 bytes (explained above).
|
||||
assert((TLD.RecordPtr + MaxSize) - static_cast<char *>(TLD.Buffer.Buffer) >=
|
||||
assert((TLD.RecordPtr + MaxSize) - static_cast<char *>(TLD.Buffer.Data) >=
|
||||
static_cast<ptrdiff_t>(MetadataRecSize) &&
|
||||
"Misconfigured BufferQueue provided; Buffer size not large enough.");
|
||||
|
||||
|
|
Loading…
Reference in New Issue