[PATCH] D41887: [libcxxabi][demangler] Clean up and llvm-ify the expression parser

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 9 15:43:02 PST 2018


erik.pilkington created this revision.
erik.pilkington added reviewers: EricWF, mclow.lists, dexonsmith.

As of https://reviews.llvm.org/D41885, every parse_* function now either returns a single Node* or fails. I'm using this new rule to clean up the parsing for the demangler, and also update it to use LLVM coding conventions. This patch updates the expression parser. The expression grammer is pretty simple, so this patch is a pretty mechanical transformation.

In the new parser:

- The position in the mangled name is held in Db, and is accessed by Db::look() and Db::consume() functions
- Parse functions now return a Node* directly instead of pushing a node onto the Name stack and having their caller immediately pop it off.
- Failed to parse mean the parse functions returns nullptr.
- LLVM style.

Thanks for taking a look!
Erik


Repository:
  rCXXA libc++abi

https://reviews.llvm.org/D41887

Files:
  src/cxa_demangle.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41887.129173.patch
Type: text/x-patch
Size: 102619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180109/56d5b377/attachment-0001.bin>


More information about the cfe-commits mailing list