This is an archive of the discontinued LLVM Phabricator instance.

[clang][ASTContext][NFCi] Refactor ASTContext::getRawCommentForDeclNoCache
AbandonedPublic

Authored by jkorous on Apr 24 2019, 4:31 PM.

Details

Summary

Factor out utility functions for documentation comments to be used in upcoming patches.

Also try not to get decomposed source location unless necessary as it is expensive.

Diff Detail

Event Timeline

jkorous created this revision.Apr 24 2019, 4:31 PM

Could you reupload this patch and other patches with context? It is difficult to review.

clang/lib/AST/ASTContext.cpp
141

No need for a semicolon.

143

Returns true if the comment which ends at CommentEndLoc is attached to the declaration at DeclLoc. The comment must be the closest one before the declaration (no other comments in between).

Also, rename to IsCommentAttachedToDecl?

154

assert?

175

No need for a semicolon.

250

It is really the "declaration location". The following code creates a RawComment with this location just because BeforeThanCompare<RawComment> needs one.

jkorous updated this revision to Diff 196761.Apr 25 2019, 5:05 PM
jkorous marked 4 inline comments as done.
  • renames
  • if => assert
jkorous marked an inline comment as done.Apr 25 2019, 5:28 PM
jkorous added inline comments.
clang/lib/AST/ASTContext.cpp
141

Right, seems like a remnant from when this function was still just a lambda.

250

You're right.

jkorous updated this revision to Diff 196878.Apr 26 2019, 10:27 AM
  • moved assert
gribozavr accepted this revision.Apr 29 2019, 12:56 AM
This revision is now accepted and ready to land.Apr 29 2019, 12:56 AM
jkorous abandoned this revision.Aug 14 2019, 3:52 PM

Abandoned in favor of
Differential Revision: https://reviews.llvm.org/D65301