aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-04-14 21:41:27 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-06-22 18:20:56 +0000
commitbdd1243df58e60e85101c09001d9812a789b6bc4 (patch)
treea1ce621c7301dd47ba2ddc3b8eaa63b441389481 /contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
parent781624ca2d054430052c828ba8d2c2eaf2d733e7 (diff)
parente3b557809604d036af6e00c60f012c2025b59a5e (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp b/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
index 651949ad5765..92b15f14c62f 100644
--- a/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
+++ b/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/Support/raw_ostream.h"
-#include "llvm/ADT/STLArrayExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Config/config.h"
#include "llvm/Support/Compiler.h"
@@ -285,10 +284,10 @@ void raw_ostream::copy_to_buffer(const char *Ptr, size_t Size) {
// Handle short strings specially, memcpy isn't very good at very short
// strings.
switch (Size) {
- case 4: OutBufCur[3] = Ptr[3]; LLVM_FALLTHROUGH;
- case 3: OutBufCur[2] = Ptr[2]; LLVM_FALLTHROUGH;
- case 2: OutBufCur[1] = Ptr[1]; LLVM_FALLTHROUGH;
- case 1: OutBufCur[0] = Ptr[0]; LLVM_FALLTHROUGH;
+ case 4: OutBufCur[3] = Ptr[3]; [[fallthrough]];
+ case 3: OutBufCur[2] = Ptr[2]; [[fallthrough]];
+ case 2: OutBufCur[1] = Ptr[1]; [[fallthrough]];
+ case 1: OutBufCur[0] = Ptr[0]; [[fallthrough]];
case 0: break;
default:
memcpy(OutBufCur, Ptr, Size);
@@ -429,7 +428,7 @@ raw_ostream &raw_ostream::operator<<(const FormattedBytes &FB) {
indent(FB.IndentLevel);
if (FB.FirstByteOffset) {
- uint64_t Offset = FB.FirstByteOffset.value();
+ uint64_t Offset = *FB.FirstByteOffset;
llvm::write_hex(*this, Offset + LineIndex, HPS, OffsetWidth);
*this << ": ";
}
@@ -480,12 +479,11 @@ static raw_ostream &write_padding(raw_ostream &OS, unsigned NumChars) {
C, C, C, C, C, C, C, C, C, C, C, C, C, C, C, C};
// Usually the indentation is small, handle it with a fastpath.
- if (NumChars < array_lengthof(Chars))
+ if (NumChars < std::size(Chars))
return OS.write(Chars, NumChars);
while (NumChars) {
- unsigned NumToWrite = std::min(NumChars,
- (unsigned)array_lengthof(Chars)-1);
+ unsigned NumToWrite = std::min(NumChars, (unsigned)std::size(Chars) - 1);
OS.write(Chars, NumToWrite);
NumChars -= NumToWrite;
}