[PATCH] D63945: Mark several PointerIntPair methods as lvalue-only

Jordan Rose via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 11:13:17 PDT 2019


jordan_rose created this revision.
jordan_rose added reviewers: jfb, rsmith.
Herald added subscribers: llvm-commits, kristina, dexonsmith.
Herald added a project: LLVM.

No point in mutating `this` if it's just going to be thrown away. This would have saved me some debugging in D63943 <https://reviews.llvm.org/D63943>.


Repository:
  rL LLVM

https://reviews.llvm.org/D63945

Files:
  llvm/include/llvm/ADT/PointerIntPair.h


Index: llvm/include/llvm/ADT/PointerIntPair.h
===================================================================
--- llvm/include/llvm/ADT/PointerIntPair.h
+++ llvm/include/llvm/ADT/PointerIntPair.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_ADT_POINTERINTPAIR_H
 #define LLVM_ADT_POINTERINTPAIR_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/PointerLikeTypeTraits.h"
 #include "llvm/Support/type_traits.h"
 #include <cassert>
@@ -59,19 +60,19 @@
 
   IntType getInt() const { return (IntType)Info::getInt(Value); }
 
-  void setPointer(PointerTy PtrVal) {
+  void setPointer(PointerTy PtrVal) LLVM_LVALUE_FUNCTION {
     Value = Info::updatePointer(Value, PtrVal);
   }
 
-  void setInt(IntType IntVal) {
+  void setInt(IntType IntVal) LLVM_LVALUE_FUNCTION {
     Value = Info::updateInt(Value, static_cast<intptr_t>(IntVal));
   }
 
-  void initWithPointer(PointerTy PtrVal) {
+  void initWithPointer(PointerTy PtrVal) LLVM_LVALUE_FUNCTION {
     Value = Info::updatePointer(0, PtrVal);
   }
 
-  void setPointerAndInt(PointerTy PtrVal, IntType IntVal) {
+  void setPointerAndInt(PointerTy PtrVal, IntType IntVal) LLVM_LVALUE_FUNCTION {
     Value = Info::updateInt(Info::updatePointer(0, PtrVal),
                             static_cast<intptr_t>(IntVal));
   }
@@ -89,7 +90,7 @@
 
   void *getOpaqueValue() const { return reinterpret_cast<void *>(Value); }
 
-  void setFromOpaqueValue(void *Val) {
+  void setFromOpaqueValue(void *Val) LLVM_LVALUE_FUNCTION {
     Value = reinterpret_cast<intptr_t>(Val);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63945.207110.patch
Type: text/x-patch
Size: 1525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190628/e4f59570/attachment.bin>


More information about the llvm-commits mailing list