How to understand what headers are included for product family


I'm working on free (with donations) Arduino IDE for 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_;  
#if defined(UBRR1H)
  extern HardwareSerial Serial1;
#if defined(UBRR2H)
  extern HardwareSerial Serial2;
#if defined(UBRR3H)
  extern HardwareSerial Serial3;

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.