Commit 18c4beb3 authored by Adam Simpkins's avatar Adam Simpkins Committed by Facebook Github Bot

logging: disallow move construction/assignment for LogCategory

Summary:
LogCategory objects store pointers to their parent and sibling categories.  The
address of each LogCategory therefore matters, and we cannot allow moving them
to another address.

Explicitly delete the move constructor and assignment operator to ensure that
no-one ever accidentally tries to move a LogCategory object.

Reviewed By: yfeldblum

Differential Revision: D6893208

fbshipit-source-id: 32f36c5992e850cc6e90d02c7c74fb758e9f745b
parent d7dfcff9
...@@ -230,6 +230,11 @@ class LogCategory { ...@@ -230,6 +230,11 @@ class LogCategory {
// Forbidden copy constructor and assignment operator // Forbidden copy constructor and assignment operator
LogCategory(LogCategory const&) = delete; LogCategory(LogCategory const&) = delete;
LogCategory& operator=(LogCategory const&) = delete; LogCategory& operator=(LogCategory const&) = delete;
// Disallow moving LogCategory objects as well.
// LogCategory objects store pointers to their parent and siblings,
// so we cannot allow moving categories to other locations.
LogCategory(LogCategory&&) = delete;
LogCategory& operator=(LogCategory&&) = delete;
void processMessage(const LogMessage& message) const; void processMessage(const LogMessage& message) const;
void updateEffectiveLevel(LogLevel newEffectiveLevel); void updateEffectiveLevel(LogLevel newEffectiveLevel);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment