mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Default DeclAttributes::getAttributes to skipping invalid attributes.
This matches the singular 'getAttribute', and all three current users of this API were passing 'false' here anyway. No functionality change.
This commit is contained in:
@@ -1249,7 +1249,7 @@ public:
|
||||
|
||||
/// Return a range with all attributes in DeclAttributes with AttrKind
|
||||
/// ATTR.
|
||||
template <typename ATTR, bool AllowInvalid>
|
||||
template <typename ATTR, bool AllowInvalid = false>
|
||||
AttributeKindRange<ATTR, AllowInvalid> getAttributes() const {
|
||||
return AttributeKindRange<ATTR, AllowInvalid>(
|
||||
make_range(begin(), end()), ToAttributeKind<ATTR, AllowInvalid>());
|
||||
|
||||
@@ -757,8 +757,8 @@ namespace {
|
||||
auto nominal = dyn_cast<NominalTypeDecl>(decl);
|
||||
if (!nominal) return nullptr;
|
||||
|
||||
for (auto attr : decl->getAttrs().getAttributes<SynthesizedProtocolAttr,
|
||||
false>()) {
|
||||
const DeclAttributes &allAttrs = decl->getAttrs();
|
||||
for (auto attr : allAttrs.getAttributes<SynthesizedProtocolAttr>()) {
|
||||
if (attr->getProtocolKind() ==
|
||||
KnownProtocolKind::BridgedStoredNSError) {
|
||||
auto &ctx = nominal->getASTContext();
|
||||
|
||||
@@ -376,11 +376,10 @@ SILFunction *SILModule::getOrCreateFunction(SILLocation loc,
|
||||
F->setClangNodeOwner(decl);
|
||||
|
||||
auto Attrs = decl->getAttrs();
|
||||
for (auto *A : Attrs.getAttributes<SemanticsAttr, false /*AllowInvalid*/>())
|
||||
for (auto *A : Attrs.getAttributes<SemanticsAttr>())
|
||||
F->addSemanticsAttr(cast<SemanticsAttr>(A)->Value);
|
||||
|
||||
for (auto *A :
|
||||
Attrs.getAttributes<SpecializeAttr, false /*AllowInvalid*/>()) {
|
||||
for (auto *A : Attrs.getAttributes<SpecializeAttr>()) {
|
||||
auto *SA = cast<SpecializeAttr>(A);
|
||||
auto kind = SA->getSpecializationKind() ==
|
||||
SpecializeAttr::SpecializationKind::Full
|
||||
|
||||
Reference in New Issue
Block a user