[clang] [clang] Guard identifier reads in pragma handlers (PR #230927)

Chen Miao via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 20 23:23:16 PDT 2026


================
@@ -101,17 +101,23 @@ void PragmaNamespace::RemovePragmaHandler(PragmaHandler *Handler) {
   Handlers.erase(I);
 }
 
+// Names may be C++ operator keywords, which have punctuator token kinds.
+static IdentifierInfo *getPragmaIdentifierInfo(const Token &Tok) {
+  if (Tok.isAnnotation() || Tok.is(tok::raw_identifier))
----------------
ChenMiaoi wrote:

This may be a bit of an edge case, but for `#pragma STDC 123`, returning early would lose the STDC-specific diagnostic for 123.

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


More information about the cfe-commits mailing list