Skip to content

Commit cb82922

Browse files
committed
Mark several PointerIntPair methods as lvalue-only
No point in mutating 'this' if it's just going to be thrown away. https://reviews.llvm.org/D63945 llvm-svn: 374102
1 parent 4b7cabf commit cb82922

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

llvm/include/llvm/ADT/PointerIntPair.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef LLVM_ADT_POINTERINTPAIR_H
1414
#define LLVM_ADT_POINTERINTPAIR_H
1515

16+
#include "llvm/Support/Compiler.h"
1617
#include "llvm/Support/PointerLikeTypeTraits.h"
1718
#include "llvm/Support/type_traits.h"
1819
#include <cassert>
@@ -59,19 +60,19 @@ class PointerIntPair {
5960

6061
IntType getInt() const { return (IntType)Info::getInt(Value); }
6162

62-
void setPointer(PointerTy PtrVal) {
63+
void setPointer(PointerTy PtrVal) LLVM_LVALUE_FUNCTION {
6364
Value = Info::updatePointer(Value, PtrVal);
6465
}
6566

66-
void setInt(IntType IntVal) {
67+
void setInt(IntType IntVal) LLVM_LVALUE_FUNCTION {
6768
Value = Info::updateInt(Value, static_cast<intptr_t>(IntVal));
6869
}
6970

70-
void initWithPointer(PointerTy PtrVal) {
71+
void initWithPointer(PointerTy PtrVal) LLVM_LVALUE_FUNCTION {
7172
Value = Info::updatePointer(0, PtrVal);
7273
}
7374

74-
void setPointerAndInt(PointerTy PtrVal, IntType IntVal) {
75+
void setPointerAndInt(PointerTy PtrVal, IntType IntVal) LLVM_LVALUE_FUNCTION {
7576
Value = Info::updateInt(Info::updatePointer(0, PtrVal),
7677
static_cast<intptr_t>(IntVal));
7778
}
@@ -89,7 +90,7 @@ class PointerIntPair {
8990

9091
void *getOpaqueValue() const { return reinterpret_cast<void *>(Value); }
9192

92-
void setFromOpaqueValue(void *Val) {
93+
void setFromOpaqueValue(void *Val) LLVM_LVALUE_FUNCTION {
9394
Value = reinterpret_cast<intptr_t>(Val);
9495
}
9596

0 commit comments

Comments
 (0)