@@ -2847,53 +2847,62 @@ class DeclAttributes {
2847
2847
SourceLoc getStartLoc (bool forModifiers = false ) const ;
2848
2848
};
2849
2849
2850
- // / Predicate used to filter attributes to only the original attributes.
2851
- class OrigDeclAttrFilter {
2850
+ // / Predicate used to filter attributes to only the parsed attributes.
2851
+ class ParsedDeclAttrFilter {
2852
2852
const Decl *decl;
2853
2853
2854
2854
public:
2855
- OrigDeclAttrFilter () : decl(nullptr ) {}
2855
+ ParsedDeclAttrFilter () : decl(nullptr ) {}
2856
2856
2857
- OrigDeclAttrFilter (const Decl *decl) : decl(decl) {}
2857
+ ParsedDeclAttrFilter (const Decl *decl) : decl(decl) {}
2858
2858
2859
2859
llvm::Optional<const DeclAttribute *>
2860
2860
operator ()(const DeclAttribute *Attr) const ;
2861
2861
};
2862
2862
2863
- // / Attributes applied directly to the declaration.
2863
+ // / Attributes written in source on a declaration.
2864
2864
// /
2865
2865
// / We should really just have \c DeclAttributes and \c SemanticDeclAttributes,
2866
2866
// / but currently almost all callers expect the latter. Instead of changing all
2867
2867
// / callers of \c getAttrs, instead provide a way to retrieve the original
2868
2868
// / attributes.
2869
- class OrigDeclAttributes {
2869
+ class ParsedDeclAttributes {
2870
2870
public:
2871
- using OrigFilteredRange = OptionalTransformRange<iterator_range<DeclAttributes::const_iterator>, OrigDeclAttrFilter>;
2871
+ using ParsedFilteredRange =
2872
+ OptionalTransformRange<iterator_range<DeclAttributes::const_iterator>,
2873
+ ParsedDeclAttrFilter>;
2872
2874
2873
2875
private:
2874
- OrigFilteredRange origRange ;
2876
+ ParsedFilteredRange parsedRange ;
2875
2877
2876
2878
public:
2877
- OrigDeclAttributes () : origRange(make_range(DeclAttributes::const_iterator(nullptr ), DeclAttributes::const_iterator(nullptr )), OrigDeclAttrFilter()) {}
2879
+ ParsedDeclAttributes ()
2880
+ : parsedRange(make_range(DeclAttributes::const_iterator(nullptr ),
2881
+ DeclAttributes::const_iterator (nullptr )),
2882
+ ParsedDeclAttrFilter()) {}
2878
2883
2879
- OrigDeclAttributes (const DeclAttributes &allAttrs, const Decl *decl) : origRange(make_range(allAttrs.begin(), allAttrs.end()), OrigDeclAttrFilter(decl)) {}
2884
+ ParsedDeclAttributes (const DeclAttributes &allAttrs, const Decl *decl)
2885
+ : parsedRange(make_range(allAttrs.begin(), allAttrs.end()),
2886
+ ParsedDeclAttrFilter(decl)) {}
2880
2887
2881
- OrigFilteredRange ::iterator begin () const { return origRange .begin (); }
2882
- OrigFilteredRange ::iterator end () const { return origRange .end (); }
2888
+ ParsedFilteredRange ::iterator begin () const { return parsedRange .begin (); }
2889
+ ParsedFilteredRange ::iterator end () const { return parsedRange .end (); }
2883
2890
2884
2891
template <typename AttrType, bool AllowInvalid>
2885
2892
using AttributeKindRange =
2886
- OptionalTransformRange<OrigFilteredRange, ToAttributeKind<AttrType, AllowInvalid>>;
2893
+ OptionalTransformRange<ParsedFilteredRange,
2894
+ ToAttributeKind<AttrType, AllowInvalid>>;
2887
2895
2888
2896
template <typename AttrType, bool AllowInvalid = false >
2889
2897
AttributeKindRange<AttrType, AllowInvalid> getAttributes () const {
2890
- return AttributeKindRange<AttrType, AllowInvalid>(origRange, ToAttributeKind<AttrType, AllowInvalid>());
2898
+ return AttributeKindRange<AttrType, AllowInvalid>(
2899
+ parsedRange, ToAttributeKind<AttrType, AllowInvalid>());
2891
2900
}
2892
2901
2893
2902
// / Retrieve the first attribute of the given attribute class.
2894
2903
template <typename AttrType>
2895
2904
const AttrType *getAttribute (bool allowInvalid = false ) const {
2896
- for (auto *attr : origRange ) {
2905
+ for (auto *attr : parsedRange ) {
2897
2906
if (auto *specificAttr = dyn_cast<AttrType>(attr)) {
2898
2907
if (specificAttr->isValid () || allowInvalid)
2899
2908
return specificAttr;
0 commit comments