[compiler-rt] r324807 - [XRay] Rename Buffer.Buffer to Buffer.Data
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 10 01:07:35 PST 2018
Author: dberris
Date: Sat Feb 10 01:07:34 2018
New Revision: 324807
URL: http://llvm.org/viewvc/llvm-project?rev=324807&view=rev
Log:
[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
Modified:
compiler-rt/trunk/lib/xray/tests/unit/buffer_queue_test.cc
compiler-rt/trunk/lib/xray/xray_buffer_queue.cc
compiler-rt/trunk/lib/xray/xray_buffer_queue.h
compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h
Modified: compiler-rt/trunk/lib/xray/tests/unit/buffer_queue_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/tests/unit/buffer_queue_test.cc?rev=324807&r1=324806&r2=324807&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/tests/unit/buffer_queue_test.cc (original)
+++ compiler-rt/trunk/lib/xray/tests/unit/buffer_queue_test.cc Sat Feb 10 01:07:34 2018
@@ -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, ErrorsWhenFinalisi
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,
Modified: compiler-rt/trunk/lib/xray/xray_buffer_queue.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_buffer_queue.cc?rev=324807&r1=324806&r2=324807&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_buffer_queue.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_buffer_queue.cc Sat Feb 10 01:07:34 2018
@@ -37,7 +37,7 @@ BufferQueue::BufferQueue(size_t B, size_
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::rele
// 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::rele
// 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;
Modified: compiler-rt/trunk/lib/xray/xray_buffer_queue.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_buffer_queue.h?rev=324807&r1=324806&r2=324807&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_buffer_queue.h (original)
+++ compiler-rt/trunk/lib/xray/xray_buffer_queue.h Sat Feb 10 01:07:34 2018
@@ -33,7 +33,7 @@ class BufferQueue {
};
struct Buffer {
- void *Buffer = nullptr;
+ void *Data = nullptr;
size_t Size = 0;
BufferExtents* Extents;
};
Modified: compiler-rt/trunk/lib/xray/xray_fdr_logging.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_logging.cc?rev=324807&r1=324806&r2=324807&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging.cc Sat Feb 10 01:07:34 2018
@@ -136,8 +136,8 @@ XRayLogFlushStatus fdrLoggingFlush() XRA
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::si
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;
}();
Modified: compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h?rev=324807&r1=324806&r2=324807&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h (original)
+++ compiler-rt/trunk/lib/xray/xray_fdr_logging_impl.h Sat Feb 10 01:07:34 2018
@@ -235,7 +235,7 @@ inline void setupNewBuffer(int (*wall_cl
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(Buf
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,
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 *LB
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(Threa
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
}
// 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.");
More information about the llvm-commits
mailing list