dblaikie added a comment. In D90714#2375911 <https://reviews.llvm.org/D90714#2375911>, @mibintc wrote:
> In D90714#2374913 <https://reviews.llvm.org/D90714#2374913>, @dblaikie wrote: > >> Since the same code is used to mangle all these things, probably just test >> one of them? >> >> Could use macros to stamp out longer names without having to write them out >> manually? > > Not sure what technique to use to stamp out longer names, I tried using token > pasting but that doesn't work because the tokens aren't macro expanded before > pasting? > #define X50 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > #define X45 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > #define X100 X50 ## X50 // X100 is X50X50 Yeah, there's a quirk of the preprocessor that means you need an extra level of indirection, like this: #define C(X) X ## X // X2: X * 2 #define X2(X) C(X) // X8: X * 2^3 (8) #define X8(X) X2(X2(X2(X))) // X4096: X * 8^4 (4096) #define X4096(X) X8(X8(X8(X8(X)))) void X4096(x)() { } https://godbolt.org/z/r6Evae > I like the test source I added because it came from a program seen in the > wild, and it demonstrates that reasonable length identifiers can generate > enormous mangled names. I think using a very plain name (like "lots of 'x'") helps clarify the test case is only about length - not about any other property of the name. A comment describing how templates (& especially template default parameters) can lead to long names could be good, though. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90714/new/ https://reviews.llvm.org/D90714 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits