r360607 - [clang][ASTContext] Call setAttached for comments attached to a declaration
Jan Korous via cfe-commits
cfe-commits at lists.llvm.org
Mon May 13 10:52:10 PDT 2019
Author: jkorous
Date: Mon May 13 10:52:09 2019
New Revision: 360607
URL: http://llvm.org/viewvc/llvm-project?rev=360607&view=rev
Log:
[clang][ASTContext] Call setAttached for comments attached to a declaration
This is a bug affecting performance when compiling with -Wdocumentation.
In Sema::ActOnDocumentable we're checking whether there are any comments unattached to declaration at the end of comment list whenever we encounter new documentable declaration.
Since this property of RawComment was never set we were trying to find comments every time and that involves at least a couple expensive SourceLocation decompositions.
Differential Revision: https://reviews.llvm.org/D61538
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=360607&r1=360606&r2=360607&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon May 13 10:52:09 2019
@@ -255,6 +255,7 @@ RawComment *ASTContext::getRawCommentFor
SourceMgr.getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second)
== SourceMgr.getLineNumber(CommentBeginDecomp.first,
CommentBeginDecomp.second)) {
+ (**Comment).setAttached();
return *Comment;
}
}
@@ -296,6 +297,7 @@ RawComment *ASTContext::getRawCommentFor
if (Text.find_first_of(";{}#@") != StringRef::npos)
return nullptr;
+ (**Comment).setAttached();
return *Comment;
}
More information about the cfe-commits
mailing list