13#ifndef LLVM_CLANG_AST_ATTRITERATOR_H
14#define LLVM_CLANG_AST_ATTRITERATOR_H
17#include "llvm/ADT/ADL.h"
18#include "llvm/ADT/SmallVector.h"
19#include "llvm/Support/Casting.h"
34template <
typename SpecificAttr,
typename Container = AttrVec>
36 using Iterator =
typename Container::const_iterator;
45 mutable Iterator Current;
47 void AdvanceToNext()
const {
48 while (!isa<SpecificAttr>(*Current))
52 void AdvanceToNext(Iterator I)
const {
53 while (Current != I && !isa<SpecificAttr>(*Current))
69 return cast<SpecificAttr>(*Current);
73 return cast<SpecificAttr>(*Current);
88 assert((Left.Current ==
nullptr) == (Right.Current ==
nullptr));
89 if (Left.Current < Right.Current)
90 Left.AdvanceToNext(Right.Current);
92 Right.AdvanceToNext(Left.Current);
93 return Left.Current == Right.Current;
97 return !(Left == Right);
101template <
typename SpecificAttr,
typename Container>
102inline specific_attr_iterator<SpecificAttr, Container>
106template <
typename SpecificAttr,
typename Container>
107inline specific_attr_iterator<SpecificAttr, Container>
112template <
typename SpecificAttr,
typename Container>
114 return specific_attr_begin<SpecificAttr>(container) !=
115 specific_attr_end<SpecificAttr>(container);
117template <
typename SpecificAttr,
typename Container>
119 using ValueTy = llvm::detail::ValueOfRange<Container>;
120 using ValuePointeeTy = std::remove_pointer_t<ValueTy>;
121 using IterTy = std::conditional_t<std::is_const_v<ValuePointeeTy>,
122 const SpecificAttr, SpecificAttr>;
123 auto It = specific_attr_begin<IterTy>(container);
124 return It != specific_attr_end<IterTy>(container) ? *It :
nullptr;
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
specific_attr_iterator - Iterates over a subrange of an AttrVec, only providing attributes that are o...
friend bool operator!=(specific_attr_iterator Left, specific_attr_iterator Right)
reference operator*() const
SpecificAttr * value_type
std::ptrdiff_t difference_type
std::forward_iterator_tag iterator_category
friend bool operator==(specific_attr_iterator Left, specific_attr_iterator Right)
specific_attr_iterator()=default
pointer operator->() const
specific_attr_iterator(Iterator i)
specific_attr_iterator & operator++()
specific_attr_iterator operator++(int)
The JSON file list parser is used to communicate input to InstallAPI.
bool hasSpecificAttr(const Container &container)
specific_attr_iterator< SpecificAttr, Container > specific_attr_end(const Container &container)
specific_attr_iterator< SpecificAttr, Container > specific_attr_begin(const Container &container)
auto * getSpecificAttr(const Container &container)