@@ -2847,53 +2847,62 @@ class DeclAttributes {
28472847 SourceLoc getStartLoc (bool forModifiers = false ) const ;
28482848};
28492849
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 {
28522852 const Decl *decl;
28532853
28542854public:
2855- OrigDeclAttrFilter () : decl(nullptr ) {}
2855+ ParsedDeclAttrFilter () : decl(nullptr ) {}
28562856
2857- OrigDeclAttrFilter (const Decl *decl) : decl(decl) {}
2857+ ParsedDeclAttrFilter (const Decl *decl) : decl(decl) {}
28582858
28592859 llvm::Optional<const DeclAttribute *>
28602860 operator ()(const DeclAttribute *Attr) const ;
28612861};
28622862
2863- // / Attributes applied directly to the declaration.
2863+ // / Attributes written in source on a declaration.
28642864// /
28652865// / We should really just have \c DeclAttributes and \c SemanticDeclAttributes,
28662866// / but currently almost all callers expect the latter. Instead of changing all
28672867// / callers of \c getAttrs, instead provide a way to retrieve the original
28682868// / attributes.
2869- class OrigDeclAttributes {
2869+ class ParsedDeclAttributes {
28702870public:
2871- using OrigFilteredRange = OptionalTransformRange<iterator_range<DeclAttributes::const_iterator>, OrigDeclAttrFilter>;
2871+ using ParsedFilteredRange =
2872+ OptionalTransformRange<iterator_range<DeclAttributes::const_iterator>,
2873+ ParsedDeclAttrFilter>;
28722874
28732875private:
2874- OrigFilteredRange origRange ;
2876+ ParsedFilteredRange parsedRange ;
28752877
28762878public:
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()) {}
28782883
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)) {}
28802887
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 (); }
28832890
28842891 template <typename AttrType, bool AllowInvalid>
28852892 using AttributeKindRange =
2886- OptionalTransformRange<OrigFilteredRange, ToAttributeKind<AttrType, AllowInvalid>>;
2893+ OptionalTransformRange<ParsedFilteredRange,
2894+ ToAttributeKind<AttrType, AllowInvalid>>;
28872895
28882896 template <typename AttrType, bool AllowInvalid = false >
28892897 AttributeKindRange<AttrType, AllowInvalid> getAttributes () const {
2890- return AttributeKindRange<AttrType, AllowInvalid>(origRange, ToAttributeKind<AttrType, AllowInvalid>());
2898+ return AttributeKindRange<AttrType, AllowInvalid>(
2899+ parsedRange, ToAttributeKind<AttrType, AllowInvalid>());
28912900 }
28922901
28932902 // / Retrieve the first attribute of the given attribute class.
28942903 template <typename AttrType>
28952904 const AttrType *getAttribute (bool allowInvalid = false ) const {
2896- for (auto *attr : origRange ) {
2905+ for (auto *attr : parsedRange ) {
28972906 if (auto *specificAttr = dyn_cast<AttrType>(attr)) {
28982907 if (specificAttr->isValid () || allowInvalid)
28992908 return specificAttr;
0 commit comments