[PATCH] D54061: [clang-tidy] run() doesn't update the SourceManager.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 5 01:15:57 PST 2018


hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

The change looks reasonable to me.

In https://reviews.llvm.org/D54061#1286505, @steveire wrote:

> After this change, it seems that `ClangTidyCheck::check` is not needed and all callers should be ported to call `run()` instead (and the private `run()` declaration should be removed from `ClangTidyCheck`.


Theoretically, we could replace `ClangTidyCheck::check` with `ClangTidyCheck::run`, but I'm not sure it is worth, `ClangTidyCheck::check` is a public API, and is widely-used (for all clang-tidy checks), replacing it requires large changes (although it is one-line change), it might break downstream clang-tidy checks.



================
Comment at: clang-tidy/ClangTidy.cpp:444
 void ClangTidyCheck::run(const ast_matchers::MatchFinder::MatchResult &Result) {
-  Context->setSourceManager(Result.SourceManager);
   check(Result);
----------------
I'd add an assertion `assert(Context->hasSourceManager())`, but it turns out ClangTidyContext doesn't provide this method...


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54061





More information about the cfe-commits mailing list