How to understand what headers are included for product family

Hello!

I'm working on free (with donations) Arduino IDE for Android - ArduinoDroid:
https://play.google.com/store/apps/details?id=name.antonsmirnov.android.arduinodroid

At this time i'm working on autocomplete feature and it's almost working, but i can't finish it without some missing knowledge.

I have to build command line (including -I and -L) for clang to parse files in memory and find autocomplete suggestion and i can't build it properly. I've analyzed command line for gcc for compilation but i still can't understand something.

For example, for HardwareSerial working (as Serial global variable) i need to include right headers for product family (or MCU). I found it analyzing HardwareSerial.h file:

#if defined(UBRRH) || defined(UBRR0H)
  extern HardwareSerial Serial;
#elif defined(USBCON)
  #include "USBAPI.h"
//  extern HardwareSerial Serial_;  
#endif
#if defined(UBRR1H)
  extern HardwareSerial Serial1;
#endif
#if defined(UBRR2H)
  extern HardwareSerial Serial2;
#endif
#if defined(UBRR3H)
  extern HardwareSerial Serial3;
#endif

How can i understand what headers should be included before if i know board type (and MCU for it). As i said i learnt verbose compile output for example sketches that use Serial var but i can't understand it yet (inclusions according to board type).

Any help is highly appreciated.