]> granicus.if.org Git - clang/commit
[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)
commit681bb9c202501f510b5ef9eb631095b5c75a0788
tree83e39281156c833d42c66f35ed5c0440acc13836
parentb04cabbff445e575f3e7bc9660df8247f7a7b844
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360833 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Lex/Preprocessor.h
lib/Lex/PPMacroExpansion.cpp
test/Preprocessor/Inputs/include-subdir/file_name_macro_include.h [new file with mode: 0644]
test/Preprocessor/Inputs/include-subdir/h [new file with mode: 0644]
test/Preprocessor/Inputs/include-subdir/subdir1/hdr1.h [new file with mode: 0644]
test/Preprocessor/Inputs/include-subdir/subdir1/hdr2.h [new file with mode: 0644]
test/Preprocessor/file_name_macro.c [new file with mode: 0644]