[PATCH] D38643: PR13575: Fix USR mangling for fixed-size arrays.

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 6 13:50:08 PDT 2017


arphaman added inline comments.


================
Comment at: lib/Index/USRGeneration.cpp:820
+    if (const ArrayType *const AT = dyn_cast<ArrayType>(T)) {
+      VisitType(AT->getElementType());
+      Out << "[";
----------------
We should probably follow the other types and just set `T = AT->getElementType()` instead of using `VisitType` and `continue` instead of `return`ing at the end of this if.


================
Comment at: lib/Index/USRGeneration.cpp:821
+      VisitType(AT->getElementType());
+      Out << "[";
+
----------------
The "[" "]" syntax could collide with the vector-type USRs. What about using another character? Maybe '{'?


================
Comment at: lib/Index/USRGeneration.cpp:826
+        case ArrayType::Star    : Out << "*"; break;
+        default                 : ;
+      }
----------------
I think it's better to check 'ArrayType::Normal' instead of `default` to ensure we will be able to distinguish between added size modifiers that could be added in the future. We should also probably give it some representation, like 'n'.


https://reviews.llvm.org/D38643





More information about the cfe-commits mailing list