Clang recently merged a change to have
__FILE_NAME__ directive that will be replaced by a C string of the current compiling file's name, without the path leading up to the file name (which would be in
This addition has a great deal of value. When full path is not necessary, the many places where it is common to use
__FILE__ (asserts, logging, etc) can move to using
__FILE_NAME__. This would reduce the binary size (paths of build systems often get very long) and avoid leaking the file hierarchy of the system that built the project.
This can also benefit unit tests that would like to use the file's name for testing against conditions but across different machines would have different values for
__FILE__ but would be the same for
For Swift, I would propose we follow the naming convention and add a new directive along side