Re: [PATCH v2 13/50] helper-to-tcg: PrepareForOptPass, demangle function names

Alessandro Di Federico via qemu development <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <20260807180326.6e915537@spawn>
On Thu, 30 Jul 2026 05:09:47 +0200
Anton Johansson <[email protected]> wrote:

> +        Index = DemangledName.find_last_of(':');
> +        if (Index != std::string::npos) {
> +            FunctionName = DemangledName.substr(Index + 1);
> +        }
> +        // Remove arguments
> +        Index = FunctionName.find_first_of('(');
> +        if (Index != std::string::npos) {
> +            FunctionName = FunctionName.substr(0, Index);
> +        }

LLVM provides a dedicated function to parse mangled
names: getFunctionBaseName. It's in LLVM, so new dependencies (I thought
was in clang).

The current code wouldn't handle `ns::function(ns::type)`.

Also, more in general: why are we setting the function name to the
name of the original C++ function name?
It's a feature worth documenting in the README along with its ratio.

Reviewed-by: Alessandro Di Federico <[email protected]>

-- 
Alessandro Di Federico
rev.ng Labs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.