[all-commits] [llvm/llvm-project] 8b0d11: [Clang][Preprocessor] Expand UCNs in macro concate...

yronglin via All-commits all-commits at lists.llvm.org
Tue Jun 24 09:56:22 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8b0d112478cec296517660c1c741b8e97aeaf684
      https://github.com/llvm/llvm-project/commit/8b0d112478cec296517660c1c741b8e97aeaf684
  Author: yronglin <yronglin777 at gmail.com>
  Date:   2025-06-25 (Wed, 25 Jun 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Lex/TokenLexer.cpp
    A clang/test/Preprocessor/macro_paste_identifier_ucn.c

  Log Message:
  -----------
  [Clang][Preprocessor] Expand UCNs in macro concatenation (#145351)

Fixs https://github.com/llvm/llvm-project/issues/145240.

The UCN in preprocessor pasted identifier not resolved to unicode, it
may cause the following issue:
```c
#define CAT(a,b) a##b

char foo\u00b5;
char*p = &CAT(foo, \u00b5); // error: use of undeclared identifier 'foo\u00b5'
```
The real identifier after paste is `fooµ`. This PR fix this issue in
`TokenLexer::pasteTokens`, if there has any UCN in pasting tokens, the
final pasted token should have a Token::HasUCN flag. Then
`Preprocessor::LookUpIdentifierInfo` will expand UCNs in this token.

Signed-off-by: yronglin <yronglin777 at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list