[clang] [clang][Diagnostics] Highlight code snippets (PR #66514)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 5 11:34:55 PDT 2023


Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm/llvm-project/pull/66514/clang at github.com>


AaronBallman wrote:

> > Also, redirecting output to a file doesn't always disable color output. From our precommit CI pipeline: https://buildkite.com/llvm-project/clang-ci/builds/4334#018af546-9a63-45f1-a8f9-6262f3d45b75 -- click on the raw log and you'll see it has contents like:
> > ```
> > �_bk;t=1696332172990�~~~ Running global pre-checkout hook
> > �_bk;t=1696332172991��[90m$�[0m /etc/buildkite-agent/hooks/pre-checkout
> > �_bk;t=1696332173007�BUILDKITE_REPO: https://github.com/llvm-premerge-tests/llvm-project.git
> > 
> > �_bk;t=1696332173008�current remote URL: https://github.com/llvm-premerge-tests/llvm-project.git
> > 
> > �_bk;t=1696332173010�GC counter 16/20
> > 
> > �_bk;t=1696332173026��[90m$�[0m cd /var/lib/buildkite-agent/builds/linux-56-7f758798dd-v9p4k-1/llvm-project/clang-ci
> > �_bk;t=1696332173026��[90m# OLDPWD added�[0m
> > �_bk;t=1696332173026��[90m# PWD changed�[0m
> > ```
> 
> Is that on purpose?

I think it is, but I'm not 100% certain. I think the intent is to get colorized output in CI when displayed via a web browser, as in:
 
![Capture](https://github.com/llvm/llvm-project/assets/4587626/34382d9e-911d-4d90-966b-042cd74ac4a6)

but still have the contents in a file so the user can download the results locally.
 
> > Did you investigate what Richard was suggesting with caching "we should be back to normal lexing here" information and re-lexing from that point? That would make me feel a lot more comfortable than re-lexing the entire file.
> 
> I am looking at it, but I'm not certain where to get the information. I definitely want to avoid adding overhead to regular, diagnostic-less lexing.

Agreed -- we should limit the overhead to the diagnostic path as much as possible (and we should continue to measure performance changes as we evolve our strategy).


https://github.com/llvm/llvm-project/pull/66514


More information about the cfe-commits mailing list