[polly] r282883 - [Support] Complete ISL annotations to IslPtr<>. NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 30 10:47:39 PDT 2016


Author: meinersbur
Date: Fri Sep 30 12:47:39 2016
New Revision: 282883

URL: http://llvm.org/viewvc/llvm-project?rev=282883&view=rev
Log:
[Support] Complete ISL annotations to IslPtr<>. NFC.

Add missing __isl_(give/take/keep) annotations to IslPtr<> and NonowningIslPtr<>
methods.

Because IslPtr's constructor's annotation would depend on the TakeOwnership
parameter, the parameter has been removed. Caller must copy the object
themselves if the do not want to take ownership.

Modified:
    polly/trunk/include/polly/Support/GICHelper.h

Modified: polly/trunk/include/polly/Support/GICHelper.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/GICHelper.h?rev=282883&r1=282882&r2=282883&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/GICHelper.h (original)
+++ polly/trunk/include/polly/Support/GICHelper.h Fri Sep 30 12:47:39 2016
@@ -248,18 +248,18 @@ template <typename T> class IslPtr {
 private:
   T *Obj;
 
-  explicit IslPtr(__isl_take T *Obj, bool TakeOwnership)
-      : Obj(TakeOwnership ? Obj : Traits::copy(Obj)) {}
+  explicit IslPtr(__isl_take T *Obj) : Obj(Obj) {}
 
 public:
   IslPtr() : Obj(nullptr) {}
   /* implicit */ IslPtr(std::nullptr_t That) : IslPtr() {}
 
-  /* implicit */ IslPtr(const ThisTy &That) : IslPtr(That.Obj, false) {}
-  /* implicit */ IslPtr(ThisTy &&That) : IslPtr(That.Obj, true) {
+  /* implicit */ IslPtr(const ThisTy &That)
+      : IslPtr(IslObjTraits<T>::copy(That.Obj)) {}
+  /* implicit */ IslPtr(ThisTy &&That) : IslPtr(That.Obj) {
     That.Obj = nullptr;
   }
-  /* implicit */ IslPtr(NonowningIslPtr<T> That) : IslPtr(That.copy(), true) {}
+  /* implicit */ IslPtr(NonowningIslPtr<T> That) : IslPtr(That.copy()) {}
   ~IslPtr() {
     if (Obj)
       Traits::free(Obj);
@@ -280,14 +280,14 @@ public:
 
   static void swap(ThisTy &LHS, ThisTy &RHS) { std::swap(LHS.Obj, RHS.Obj); }
 
-  static ThisTy give(T *Obj) { return ThisTy(Obj, true); }
+  static ThisTy give(__isl_take T *Obj) { return ThisTy(Obj); }
   T *keep() const { return Obj; }
-  T *take() {
+  __isl_give T *take() {
     auto *Result = Obj;
     Obj = nullptr;
     return Result;
   }
-  T *copy() const { return Traits::copy(Obj); }
+  __isl_give T *copy() const { return Traits::copy(Obj); }
 
   isl_ctx *getCtx() const { return Traits::get_ctx(Obj); }
   std::string toStr() const { return Traits::to_str(Obj); }
@@ -344,7 +344,7 @@ public:
   static void swap(ThisTy &LHS, ThisTy &RHS) { std::swap(LHS.Obj, RHS.Obj); }
 
   T *keep() const { return Obj; }
-  T *copy() const { return Traits::copy(Obj); }
+  __isl_give T *copy() const { return Traits::copy(Obj); }
 
   isl_ctx *getCtx() const { return Traits::get_ctx(Obj); }
   std::string toStr() const { return Traits::to_str(Obj); }




More information about the llvm-commits mailing list