[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

Kristina Brooks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 3 08:04:26 PST 2019


kristina added a comment.

In D17741#1345171 <https://reviews.llvm.org/D17741#1345171>, @NSProgrammer wrote:

> To throw in my 2 cents.  I don’t really have a preference between a compiler flag vs a different macro that’s just for the file name sans path prefix.  But I have a real need for this to get into clang:  with 1.2 million lines of code, the regular placement of log statements and custom asserts leads to megabytes in binary size from all the __FILE__ usages, and that could easily be a few hundred KB with this kind of support in clang.


Yeah that would only require adding a new macro in `lib/Lex/PPMacroExpansion.cpp` plus a test instead of a huge diff as it is now. So yes as I said, that would be a great patch. However this implementation is is needlessly complicated and I don't think this should be yet another driver/compiler flag for a seemingly obscure use case. So yes I'm with you on that, filename without the path prefix is definitely an extension I'd like to see upstreamed (I proposed it on `cfe-dev` a while ago but it wasn't well received so I never put it up for review (that was before the weird preprocessor stuff that I do now in my fork)).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D17741/new/

https://reviews.llvm.org/D17741





More information about the cfe-commits mailing list