[PATCH] D46000: [AST] Added a helper to extract a user-friendly text of a comment.
Eric Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 9 14:14:11 PDT 2018
ioeric added a comment.
Thanks for adding the tests!
================
Comment at: include/clang/AST/RawCommentList.h:138
+ /// the overload with ASTContext in the rest of the code.
+ std::string getFormattedText(const SourceManager &SourceMgr,
+ DiagnosticsEngine &Diags) const;
----------------
I think we can get rid of the interface that takes `ASTContext`? If `SourceManager` and `Diags` are sufficient, I don't see why we would want another interface for ASTContext.
================
Comment at: lib/AST/RawCommentList.cpp:352
+ // comments::Lexer. Therefore, we just use default-constructed options.
+ CommentOptions DefOpts;
+ comments::CommandTraits EmptyTraits(Allocator, DefOpts);
----------------
I'm not quite sure about this. Could we just require a `CommandTraits` in the interface? And only make this assumption in tests?
================
Comment at: unittests/AST/CommentTextTest.cpp:32
+ std::string formatComment(llvm::StringRef CommentText) {
+ llvm::IntrusiveRefCntPtr<vfs::InMemoryFileSystem> EmptyFS(
+ new vfs::InMemoryFileSystem);
----------------
`SourceManagerForFile` added in D46176 should save you a few lines here. (I'm landing it right now...)
Repository:
rC Clang
https://reviews.llvm.org/D46000
More information about the cfe-commits
mailing list