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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 2 17:27:40 PDT 2018


sammccall created this revision.
sammccall added reviewers: hokein, alexfh.
Herald added subscribers: cfe-commits, xazax.hun.

By now the context's SourceManager is now initialized everywhere that
ClangTidyCheck::registerMatcher() is called, so the call from run() seems
entirely redundant, and indeed all the tests pass.

This solves a problem with embedding clang-tidy: if using a DiagnosticsEngine
which already has file state, re-setting its SourceManager (to the same value)
causes an assertion.
(There are other ways to solve this problem, but this is the simplest).


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54061

Files:
  clang-tidy/ClangTidy.cpp


Index: clang-tidy/ClangTidy.cpp
===================================================================
--- clang-tidy/ClangTidy.cpp
+++ clang-tidy/ClangTidy.cpp
@@ -441,7 +441,6 @@
 }
 
 void ClangTidyCheck::run(const ast_matchers::MatchFinder::MatchResult &Result) {
-  Context->setSourceManager(Result.SourceManager);
   check(Result);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54061.172471.patch
Type: text/x-patch
Size: 340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181103/49cf4070/attachment.bin>


More information about the cfe-commits mailing list