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

via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 15 04:39:25 PDT 2023


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


================
@@ -887,6 +906,9 @@ void Preprocessor::Lex(Token &Result) {
     switch (CurLexerKind) {
     case CLK_Lexer:
       ReturnedToken = CurLexer->Lex(Result);
+      if (ReturnedToken && CurLexer &&
+          CurLexer->getFileID() == SourceMgr.getMainFileID())
+        saveCheckPoint(CurLexer->BufferPtr);
----------------
cor3ntin wrote:

Should we test for `IsAtStartOfLine` here?


```suggestion
      if (ReturnedToken &&
          CurLexer->getFileID() == SourceMgr.getMainFileID())
        saveCheckPoint(CurLexer->BufferPtr);
```

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


More information about the cfe-commits mailing list