Is it possible to generate the IR representation with the original macro information?

Hi,

I use the following commands to compile the IR. But I don't see the
macro information in the .ll file. Is there a way to preserve the
macro information (print() in this case) for debugging purposes?

$ clang -std=gnu99 -g3 -flto -Wall -pedantic -c -o main.o main.c
$ clang main.o -flto -fuse-ld=gold '-Wl,-plugin-opt=save-temps' -o main.exe
$ llvm-dis main.exe.0.0.preopt.bc

/* vim: set noexpandtab tabstop=2: */
#include <stdio.h>

#define print() puts("Hello World!");

int main() {
    print();
    return 0;
}

-g -fdebug-macro will include macro info in the debug info in the IR. It doesn’t track which bits of IR were expanded from macros (anymore than the source locations do without -fdebug-macro) - just provides the macro text so, for instance, debugger users can use the macros in expresions.

So there is no way to associate macro to IR code? Thanks.

Unfortunately, no