[Lldb-commits] [PATCH] D52461: [PDB] Introduce `PDBNameParser`

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 15 10:53:26 PDT 2018


zturner added a comment.

In https://reviews.llvm.org/D52461#1265335, @aleksandr.urakov wrote:

> Hello!
>
> I just have tried to patch `CPlusPlusNameParser` in the way to support MSVC demangled names, but there is a problem. `CPlusPlusNameParser` splits an incoming name in tokens with `clang::Lexer`. I've lexed the next name:
>
>   `anonymous namespace'::foo
>
>
> The lexer treats the first character (a grave accent) as an unknown token, and it's ok for our purposes. Then it sees an identifier (`anonymous`), a keyword (`namespace`), and it's ok too. But the problem is with the last part of the string. The lexer sees an apostrophe and supposes that it's a character constant, it looks for a closing apostrophe, don't find it and treats all the line ending (`'::foo`) as a single unknown token.
>
> It is possible to somehow make `clang::Lexer` lex MSVC demangled names correctly, but I'm not sure if it is the right place to do it. And it may have then some side effects during lexing a real code.
>
> Another option is to somehow preprocess the name before lexing and replace all //paired// apostrophes with grave accents, and after lexing replace with apostrophes back, and make `CPlusPlusNameParser` understand unknown grave accent tokens. But it's a bit tricky, may be you can suggest some better solution?


Just handle the `anonymous namespace' thing specially before passing to `CPlusPlusNameParser`.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D52461





More information about the lldb-commits mailing list