Skip to content

Commit b48eabd

Browse files
committed
Sema: keep FinalAttr in decl->getAttrs for print order compatibility
1 parent c50280f commit b48eabd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/AST/TypeCheckRequests.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ void IsFinalRequest::cacheResult(bool value) const {
248248
auto decl = std::get<0>(getStorage());
249249
decl->LazySemanticInfo.isFinalComputed = true;
250250
decl->LazySemanticInfo.isFinal = value;
251+
252+
// Register Final in attributes, to preserve print order
253+
if (value && !decl->getAttrs().hasAttribute<FinalAttr>())
254+
decl->getAttrs().add(new (decl->getASTContext()) FinalAttr(/*Implicit=*/true));
251255
}
252256

253257
//----------------------------------------------------------------------------//

0 commit comments

Comments
 (0)