IDA FLIRT custom signatures break MSVC mangling

When you create IDA FLIRT file from database, I noticed that function names are stripped of :, .c and % symbols replacing them with _, and this breaks MSVC mangling of the original function signatures, especially those that were defined in anonymous namespaces. Please fix this.

Hi there, could you please fill out a Bug Report with some samples and steps to reproduce? Then we can look into this properly. Thanks!

Steps to reproduce:

  1. Open MyProject.exe with PDB
    shared.7z (25.8 KB)
  2. Produce File > Create SIG File...
  3. Copy MyProject.exe but do not load with PDB
  4. Apply previously created signature
  5. Turn on demangling and see the differencies

In the original file with PDB, everything demangles correctly because it’s naturally produced compiler symbol. The second file, on the other hand, has anonymous namespace::foo demangling broken because IDA FLIRT stripped %, : and . symbols that were part of the mangling.