Which include file is used during the build process?

Hello,
I apologize if this is an obvious question or if it has been asked before. I'm new to Arduino IDE. I am confused about the build process, specifically, the include paths. I looked here: http://www.arduino.cc/en/Hacking/BuildProcess but couldn't find the answer to my problem.

I am developing for the esp8266 (refer: esp8266-github). Within "WiFiClient.", the following lines are present:

#include "Client.h"
#include "IPAddress.h"

Since these files don't exist within the "src/" directory there, the pre-processor should look in the other default include paths, correct?

Now the file "IPAddress.h" is present in "Arduino/cores/esp8266/IPAddress.h" as well as "Arduino/hardware/arduino/avr/cores/arduino/IPAddress.h"

So how does it know which one to pick? Which config file, include path or some other setting determines this?

Thank you.

The default paths are searched in the order they are defined. It uses the first one encountered during that search.

Where can I find the default paths?

No idea. It's gotta be in a config file or .ini file or preferences file somewhere underneath where you installed the IDE or out in C:\Users...

If you just want to know which one you are using, simply open one of them up and add a Serial.print in there somewhere where you are sure it will run. Then compile, run, and see if it shows up. If it does, you know that one is being used.