[Clang][PP] Add the __FILE_NAME__ builtin macro.
authorKristina Brooks <notstina@gmail.com>
Thu, 16 May 2019 00:52:41 +0000 (00:52 +0000)
committerKristina Brooks <notstina@gmail.com>
Thu, 16 May 2019 00:52:41 +0000 (00:52 +0000)
commit3acc1d1be329d9f6e363c34c455fec86e0c4935c
tree69a501f5b6ce0545070ad7128315093288a6b158
parente7ab59eda98094183cd4d75f5edde9e07e27072b
[Clang][PP] Add the __FILE_NAME__ builtin macro.

This patch adds the `__FILE_NAME__` macro that expands to the
last component of the path, similar to `__FILE__` except with
a guarantee that only the last path component (without the
separator) will be rendered.

I intend to follow through with discussion of this with WG14
as a potential inclusion in the C standard or failing that,
try to discuss this with GCC developers since this extension
is desired by GCC and Clang users/developers alike.

Differential Revision: https://reviews.llvm.org/D61756

llvm-svn: 360833
clang/include/clang/Lex/Preprocessor.h
clang/lib/Lex/PPMacroExpansion.cpp
clang/test/Preprocessor/Inputs/include-subdir/file_name_macro_include.h [new file with mode: 0644]
clang/test/Preprocessor/Inputs/include-subdir/h [new file with mode: 0644]
clang/test/Preprocessor/Inputs/include-subdir/subdir1/hdr1.h [new file with mode: 0644]
clang/test/Preprocessor/Inputs/include-subdir/subdir1/hdr2.h [new file with mode: 0644]
clang/test/Preprocessor/file_name_macro.c [new file with mode: 0644]