From: Bill Wendling Date: Sun, 10 Feb 2013 10:12:06 +0000 (+0000) Subject: Add 'empty' query methods to the builder and use them in the verifier. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=87de71cb9f12d874e88d4f314ab245985c1b36bc;p=oota-llvm.git Add 'empty' query methods to the builder and use them in the verifier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174832 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/Attributes.h b/include/llvm/IR/Attributes.h index 38f4ed983e6..2a0363ceb21 100644 --- a/include/llvm/IR/Attributes.h +++ b/include/llvm/IR/Attributes.h @@ -471,6 +471,8 @@ public: const_iterator begin() const { return Attrs.begin(); } const_iterator end() const { return Attrs.end(); } + bool empty() const { return Attrs.empty(); } + // Iterators for target-dependent attributes. typedef std::pair td_type; typedef std::map::iterator td_iterator; @@ -482,6 +484,8 @@ public: td_const_iterator td_begin() const { return TargetDepAttrs.begin(); } td_const_iterator td_end() const { return TargetDepAttrs.end(); } + bool td_empty() const { return TargetDepAttrs.empty(); } + /// \brief Remove attributes that are used on functions only. void removeFunctionOnlyAttrs() { removeAttribute(Attribute::NoReturn) diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index babc295126e..31312dc1c41 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -744,7 +744,7 @@ void Verifier::VerifyFunctionAttrs(FunctionType *FT, AttrBuilder NotFn(Attrs, AttributeSet::FunctionIndex); NotFn.removeFunctionOnlyAttrs(); - Assert1(!NotFn.hasAttributes(), "Attribute '" + + Assert1(NotFn.empty(), "Attributes '" + AttributeSet::get(V->getContext(), AttributeSet::FunctionIndex, NotFn).getAsString(AttributeSet::FunctionIndex) +