Modifying a string with LLVM Module

Hello LLVM-people,

I compiled a source file - containing a string - with Clang-cl to IR and… found my string there again, which looks like that:

@"??_C@_1BO@NHIBMFPN@?$AAS?$AAc?$AAh?$AAw?$AAi?$AAm?$AAm?$AAf?$AAl?$AAu?$AAe?$AAg?$AAe?$AAl?$AA?$AA@" = linkonce_odr dso_local unnamed_addr constant [15 x i16] [i16 83, i16 99, i16 104, i16 119, i16 105, i16 109, i16 109, i16 102, i16 108, i16 117, i16 101, i16 103, i16 101, i16 108, i16 0], comdat, align 2

Which should be the string “Schwimmfluegel” in Windows wchar_t. This module is later loaded and will be jitted.

My question is, can I modify the content of the string? Even change it from 16 bit to 32 bit (adjusting the alignment as well of course) and how would I do that?

I’m not much familiar with editing a LLVM Module in code - but I guess the first thing is to search for the strings (or strings in general) so I would start with:

for(auto &global : module->globals())

{

}

However… there my knowledge already stops x.x"

Do I need to check the mangled name of my symbol to identify it as a string or does “global” provide a function for that? And then of course… how to proceed reading the string content? Writing it, extending it - changing the underlying type?

Any help is appreciated >o<

Kind greetings

Björn