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