[PATCH] D41736: make attribute instantiation instantiate all attributes

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 4 11:25:03 PST 2018


erichkeane added a comment.

Presumably this didn't break any tests, so I'm Ok with it.  The initial patch was to make sure that template specializations could clear certain attributes, so I think this properly gets that done.  The below test was apparently missed in the initial patch (and was the reason for the revert/restore), so perhaps this is something that could be validated still works as well.  See comments here: https://reviews.llvm.org/rL298410

class Mutex {
public:

  void Lock() __attribute__((exclusive_lock_function()));
  void Unlock() __attribute__((unlock_function()));

};

class A {
public:

  Mutex mu1, mu2;
  
  void foo() __attribute__((exclusive_locks_required(mu1))) __attribute__((exclusive_locks_required(mu2))) {}
  
  template <class T> void bar() __attribute__((exclusive_locks_required(mu1))) __attribute__((exclusive_locks_required(mu2))) {
    foo();
  }

};

void f() {

  A a;
  a.mu1.Lock();
  a.mu2.Lock();
  a.bar<int>();
  a.mu2.Unlock();
  a.mu1.Unlock();

}


Repository:
  rC Clang

https://reviews.llvm.org/D41736





More information about the cfe-commits mailing list