[PATCH] D82481: [XCOFF][AIX] Give symbol an internal name when desired symbol name contains invalid character(s)

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 11:29:51 PDT 2020


hubert.reinterpretcast added inline comments.


================
Comment at: llvm/lib/MC/MCContext.cpp:313
+  SmallString<128> InvalidName(OriginalName);
+  // Replace the invalid character with '_'.
+  for (size_t I = 0; I < InvalidName.size(); ++I) {
----------------
Although this encoding generates runs of underscores, it does make it less intrusive in terms of being able to use `c++filt` on the result. Note that collisions increase with non-Latin scripts (which could be reduced if we append the hex values of all the underscores, including the original ones, to the end of the string).
```
namespace ImplVerTags {

typedef struct
一世
{} A;
typedef struct
二世
{} B;

}

template <typename> void *implStaticDataUnsafe = nullptr;

template void *implStaticDataUnsafe<ImplVerTags::A>;
template void *implStaticDataUnsafe<ImplVerTags::B>;
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82481/new/

https://reviews.llvm.org/D82481





More information about the llvm-commits mailing list