Skip to content

Commit 74c85d6

Browse files
committed
Allow checks access to the SourceManager
* This modification of the Clang-tidy basic headers seems to be the only way to get access to the SourceManager from within the checks * Reason: I would like to be able to analyse locations independent of the diag() function
1 parent 6994634 commit 74c85d6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ClangTidyDiagnosticConsumer.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ class ClangTidyContext {
151151
/// This is called from the \c ClangTidyCheck base class.
152152
void setSourceManager(SourceManager *SourceMgr);
153153

154+
/// \brief Allow checks to access the SourceManager directly
155+
///
156+
SourceManager &getSourceManager() const { return DiagEngine->getSourceManager(); }
157+
158+
154159
/// \brief Should be called when starting to process new translation unit.
155160
void setCurrentFile(StringRef File);
156161

0 commit comments

Comments
 (0)