diff options
author | Andy Getzendanner <durandal@google.com> | 2022-10-05 10:59:15 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-10-05 11:00:04 -0700 |
commit | 1fd600dc490db4db0ebf7bcc629d8914e828467e (patch) | |
tree | 56823469c81a13a120cf655fc87072b874939f6e | |
parent | b3162b1da62711c663d0025e2eabeb83fd1f2728 (diff) |
Delete LogEntry's copy ctor and assignment operator.
This is an immutable view type, and the viewed data have a very limited lifetime. Since it's immutable and has no public constructor, there's no way to repoint one at a longer-lived copy of the data.
PiperOrigin-RevId: 479089273
Change-Id: I2ea70878edc45fa1774c8fd26dee3a1b726d8b4a
-rw-r--r-- | absl/log/log_entry.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/absl/log/log_entry.h b/absl/log/log_entry.h index d90961fe..30114c33 100644 --- a/absl/log/log_entry.h +++ b/absl/log/log_entry.h @@ -58,8 +58,10 @@ class LogEntry final { static constexpr int kNoVerbosityLevel = -1; static constexpr int kNoVerboseLevel = -1; // TO BE removed - LogEntry(const LogEntry&) = default; - LogEntry& operator=(const LogEntry&) = default; + // Pass `LogEntry` by reference, and do not store it as its state does not + // outlive the call to `LogSink::Send()`. + LogEntry(const LogEntry&) = delete; + LogEntry& operator=(const LogEntry&) = delete; // Source file and line where the log message occurred. Taken from `__FILE__` // and `__LINE__` unless overridden by `LOG(...).AtLocation(...)`. |