Support a common idiom on how to build an Attributes class with a single attribute.
authorBill Wendling <isanbard@gmail.com>
Thu, 11 Oct 2012 01:05:52 +0000 (01:05 +0000)
committerBill Wendling <isanbard@gmail.com>
Thu, 11 Oct 2012 01:05:52 +0000 (01:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165686 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Attributes.h
lib/VMCore/Attributes.cpp

index d20a47a286e5b182b42e98bb0b2a17094573a13b..8b43e08f084df3d140d2afcc318df6078cdc73b8 100644 (file)
@@ -95,6 +95,7 @@ private:
 public:
   Attributes() : Attrs(0) {}
   explicit Attributes(uint64_t Val);
+  explicit Attributes(AttrVal Val);
   Attributes(const Attributes &A);
 
   class Builder {
index 0625ef3f09c64388d7b8ff0f1e2d683f7525e646..7ae823214bbd869f43e849c4e7f00229b115e565 100644 (file)
@@ -29,6 +29,9 @@ using namespace llvm;
 
 Attributes::Attributes(uint64_t Val) : Attrs(Val) {}
 
+Attributes::Attributes(AttrVal Val)
+  : Attrs(Attributes::get(Attributes::Builder().addAttribute(Val)).Attrs) {}
+
 Attributes::Attributes(AttributesImpl *A) : Attrs(A->Bits) {}
 
 Attributes::Attributes(const Attributes &A) : Attrs(A.Attrs) {}