Why is the MangleContext not owned by ASTContext?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Why is the MangleContext not owned by ASTContext?

Sam McCall via cfe-dev
Hi list,

I was trying to extend Clang with a new PredefinedExpr that basically does the same as __FUNCDNAME__ and was getting unexpected results for mangling function names with lambdas as parameters. It was unexpected for me, because every lambda gets ID 0 in its mangles name and I tracked it down to the way the MangleContext is handled. In PredefinedExpr::ComputeName createMangleContext from the ASTContext is called and after the mangling is done the context is thrown away which is why I just got 0s. Anyway, I would like to know why the MC is not owned by the ASTContext? Are there use cases where more than one MC is necessary? Can something break if the MC is alive for the entire compilation from AST creation to CG?

Cheers,
Michael Haidl
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev