forked from OSchip/llvm-project
[clang][dataflow] Make `Value` and `StorageLocation` non-copyable
This makes it harder to misuse APIs that return references by accidentally copying the results which could happen when assigning the them to variables declared as `auto`. Differential Revision: https://reviews.llvm.org/D127865 Reviewed-by: ymandel, xazax.hun
This commit is contained in:
parent
4cd04d1687
commit
0c2edf27a2
|
@ -31,6 +31,12 @@ public:
|
|||
|
||||
StorageLocation(Kind LocKind, QualType Type) : LocKind(LocKind), Type(Type) {}
|
||||
|
||||
// Non-copyable because addresses of storage locations are used as their
|
||||
// identities throughout framework and user code. The framework is responsible
|
||||
// for construction and destruction of storage locations.
|
||||
StorageLocation(const StorageLocation &) = delete;
|
||||
StorageLocation &operator=(const StorageLocation &) = delete;
|
||||
|
||||
virtual ~StorageLocation() = default;
|
||||
|
||||
Kind getKind() const { return LocKind; }
|
||||
|
|
|
@ -47,6 +47,12 @@ public:
|
|||
|
||||
explicit Value(Kind ValKind) : ValKind(ValKind) {}
|
||||
|
||||
// Non-copyable because addresses of values are used as their identities
|
||||
// throughout framework and user code. The framework is responsible for
|
||||
// construction and destruction of values.
|
||||
Value(const Value &) = delete;
|
||||
Value &operator=(const Value &) = delete;
|
||||
|
||||
virtual ~Value() = default;
|
||||
|
||||
Kind getKind() const { return ValKind; }
|
||||
|
|
Loading…
Reference in New Issue