Add 'empty' query methods to the builder and use them in the verifier.
authorBill Wendling <isanbard@gmail.com>
Sun, 10 Feb 2013 10:12:06 +0000 (10:12 +0000)
committerBill Wendling <isanbard@gmail.com>
Sun, 10 Feb 2013 10:12:06 +0000 (10:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174832 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Attributes.h
lib/IR/Verifier.cpp

index 38f4ed983e6ad8f6eb6707b0f8129ac9731712da..2a0363ceb2152bbd93f31a9ab963765110747349 100644 (file)
@@ -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<std::string, std::string>                td_type;
   typedef std::map<std::string, std::string>::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)
index babc295126e82315c8d686754474b5b06393426b..31312dc1c41f0cd6931dde2e90a0d276275dcd2c 100644 (file)
@@ -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) +