[Lldb-commits] [PATCH] D52461: [PDB] Introduce `PDBNameParser`
Aleksandr Urakov via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 15 06:17:52 PDT 2018
aleksandr.urakov added a subscriber: labath.
aleksandr.urakov added a comment.
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?
Repository:
rLLDB LLDB
https://reviews.llvm.org/D52461
More information about the lldb-commits
mailing list