How can I do for macro expansion like what the visual c++'s /p C pre-processor does?

In visual studio 2013 I can use the “Preprocess to a File” ( /p pre-processor ) to do macro expansion.

For example :

//original file : MySample.cpp
#define AA(…)
public :
int m_a;
class FPSSample
{
AA();
}

//file with macro expansion: MySample.i
class FPSSample
{
public :
int m_a;
}

What the thing I want is that to look the macro (GENERATED_UCLASS_BODY() UCLASS() etc., ) expansion.

I am a student and I am curious for that. thank you!

UCLASS and macros like that are not used during compile time, but used as markers by UHT (Unreal Header Tool) to generate header files which generates extra code for your header file which helps serialize Properties, Functions etc. which later is used in Blueprint system or garbage collection for example. Note that if you do something wrong in those macros errors appear during header file generation, not compilation. Engine source code has dummy version of those macros so they are ignored by the compiler.

GENERATED_UXXXXX_BODY macros are used to place that UHT generated content in to class header file, which is contained XXXXXX.generated.h. So if you want o study how this work see definition of that macro in generated header, quick way to do that is right click the macro in VS and “Go To Definition”. Also check UHT source code which is in engine source code

OK. Thank you for your answer.