[all-commits] [llvm/llvm-project] 3b677b: [libtooling][clang-tidy] Fix diagnostics not highl...

Whisperity via All-commits all-commits at lists.llvm.org
Sat Apr 10 07:44:47 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b677b81cec7b3c5132aee8fccc30252d87deb69
      https://github.com/llvm/llvm-project/commit/3b677b81cec7b3c5132aee8fccc30252d87deb69
  Author: Whisperity <whisperity at gmail.com>
  Date:   2021-04-10 (Sat, 10 Apr 2021)

  Changed paths:
    M clang-tools-extra/clang-tidy/ClangTidy.cpp
    M clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/test/clang-tidy/infrastructure/export-diagnostics.cpp
    M clang-tools-extra/unittests/clang-apply-replacements/ApplyReplacementsTest.cpp
    M clang-tools-extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp
    M clang/include/clang/Tooling/Core/Diagnostic.h
    M clang/include/clang/Tooling/DiagnosticsYaml.h
    M clang/lib/Tooling/Core/Diagnostic.cpp
    M clang/unittests/Tooling/DiagnosticsYamlTest.cpp

  Log Message:
  -----------
  [libtooling][clang-tidy] Fix diagnostics not highlighting fed SourceRanges

Fixes bug http://bugs.llvm.org/show_bug.cgi?id=49000.

This patch allows Clang-Tidy checks to do

    diag(X->getLocation(), "text") << Y->getSourceRange();

and get the highlight of `Y` as expected:

    warning: text [blah-blah]
        xxx(something)
        ^   ~~~~~~~~~

Reviewed-By: aaron.ballman, njames93

Differential Revision: http://reviews.llvm.org/D98635




More information about the All-commits mailing list