Skip to content

Commit 995528e

Browse files
committed
[AST] Remove AccessorDecl handling from getSourceRangeIncludingAttrs
It doesn't seem like this is necessary anymore since we no longer clone OverrideAttrs when checking overrides (except when invalidating). Moreover, it's now actively wrong since accessors introduced by macro expansions may be in different buffers than their their storage, so checking `isBeforeInBuffer` will non-deterministically result in the wrong source range.
1 parent e5d0cd4 commit 995528e

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

lib/AST/Decl.cpp

-20
Original file line numberDiff line numberDiff line change
@@ -966,26 +966,6 @@ case DeclKind::ID: return cast<ID##Decl>(this)->getSourceRange();
966966
SourceRange Decl::getSourceRangeIncludingAttrs() const {
967967
auto Range = getSourceRange();
968968

969-
// Attributes on AccessorDecl may syntactically belong to PatternBindingDecl.
970-
// e.g. 'override'.
971-
if (auto *AD = dyn_cast<AccessorDecl>(this)) {
972-
// If this is implicit getter, accessor range should not include attributes.
973-
if (AD->isImplicitGetter())
974-
return Range;
975-
976-
// Otherwise, include attributes directly attached to the accessor.
977-
SourceLoc VarLoc = AD->getStorage()->getStartLoc();
978-
for (auto *Attr : getParsedAttrs()) {
979-
if (!Attr->getRange().isValid())
980-
continue;
981-
982-
SourceLoc AttrStartLoc = Attr->getRangeWithAt().Start;
983-
if (getASTContext().SourceMgr.isBeforeInBuffer(VarLoc, AttrStartLoc))
984-
Range.widen(AttrStartLoc);
985-
}
986-
return Range;
987-
}
988-
989969
// Attributes on VarDecl syntactically belong to PatternBindingDecl.
990970
if (isa<VarDecl>(this) && !isa<ParamDecl>(this))
991971
return Range;

0 commit comments

Comments
 (0)