Fixes bug #49000.
Currently, when a diagnostic in Clang-Tidy is produced as diag(Var->getLocation(), "foo %0") << "bar" << Var->getSourceRange();, the source range specified to be highlighted is discarded, i.e.
x.cpp:21:18: warning: foo bar [blah-blah-checker] void fun(int I, int J, int K) {} ^
is created instead of producing a full highlight:
x.cpp:21:18: warning: foo bar [blah-blah-checker] void fun(int I, int J, int K) {} ~~~~^
This creates a discrepancy between warnings generated in Clang::Sema which work properly, and in Tidy.
This patch fixes the issue by making sure Clang-Tidy's logic of decoupling ranges from the SourceManager and rendering them later respects custom ranges that are fed into a diagnostic.
nit: Elide braces.