From 3183951d88680d6077dbb7a4b0daf84124434f45 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 11 Oct 2012 01:05:52 +0000 Subject: [PATCH] Support a common idiom on how to build an Attributes class with a single attribute. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165686 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Attributes.h | 1 + lib/VMCore/Attributes.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h index d20a47a286e..8b43e08f084 100644 --- a/include/llvm/Attributes.h +++ b/include/llvm/Attributes.h @@ -95,6 +95,7 @@ private: public: Attributes() : Attrs(0) {} explicit Attributes(uint64_t Val); + explicit Attributes(AttrVal Val); Attributes(const Attributes &A); class Builder { diff --git a/lib/VMCore/Attributes.cpp b/lib/VMCore/Attributes.cpp index 0625ef3f09c..7ae823214bb 100644 --- a/lib/VMCore/Attributes.cpp +++ b/lib/VMCore/Attributes.cpp @@ -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) {} -- 2.34.1