[PATCH] D38707: PR13575: Fix USR mangling for functions taking function pointers as arguments.

Jan Korous via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 9 16:21:07 PDT 2017


jkorous-apple added inline comments.


================
Comment at: lib/Index/USRGeneration.cpp:757
       VisitType(FT->getReturnType());
-      for (const auto &I : FT->param_types())
+      Out << '(';
+      for (const auto &I : FT->param_types()) {
----------------
arphaman wrote:
> I believe you can drop the '(' and ')'. The '#' should be enough to prevent the USR collision.
Actually, this is a great question!

I was worried it might not be the case so I created two more test cases. 
Let's try to imagine there are no parentheses in those USRs.
First two test cases could be solved by using 'v' or something for functions taking no arguments. But 3rd and 4th test cases would definitely need some disambiguation then.

I am not saying this is the only possible way how to represent function pointers but for proposed solution those parentheses are needed.


https://reviews.llvm.org/D38707





More information about the cfe-commits mailing list