[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-05-09 Thread Kristina Brooks via Phabricator via cfe-commits
kristina abandoned this revision. kristina added a comment. Superseded by D61756 CHANGES SINCE LAST ACTION https://reviews.llvm.org/D17741/new/ https://reviews.llvm.org/D17741 ___ cfe-commits mailing list

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-05-08 Thread Kristina Brooks via Phabricator via cfe-commits
kristina commandeered this revision. kristina added a reviewer: weimingz. kristina added a comment. Sorry, forgot about this, will make a new diff with just the macro for review later tonight. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D17741/new/ https://reviews.llvm.org/D17741

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-05-08 Thread Nolan O'Brien via Phabricator via cfe-commits
NSProgrammer added a comment. In D17741#1413864 , @kristina wrote: > If the author is still missing at the end of next week, any objections to me > resubmitting a similar patch that just implements `__FILE_NAME__` or > `__BASE_NAME__` (Need a few more

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-02-28 Thread Kristina Brooks via Phabricator via cfe-commits
kristina added a comment. If the author is still missing at the end of next week, any objections to me resubmitting a similar patch that just implements `__FILE_NAME__` or `__BASE_NAME__` (Need a few more opinions here I guess, personally I think `__FILE_NAME__` makes more sense)? I'll carve

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-02-22 Thread Nolan O'Brien via Phabricator via cfe-commits
NSProgrammer added a comment. We would prefer a macro like `__FILE_NAME__` over a build flag for code reading consistency (they would clearly do different things vs varying based on an obscure flag being present/absent). This patch is languishing, unless the original author thinks otherwise, a

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-07 Thread Kristina Brooks via Phabricator via cfe-commits
kristina added a comment. Ping for author? This is one of the changes I'd like to see through, though the complexity here can be massively reduced as stated above. I wouldn't mind opening a new diff if the author is away with just a change in PPMacroExpansion and a testcase (which should

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Jan 03, 2019 at 05:01:00PM +, Ximin Luo via cfe-commits wrote: > My patch that Roman quoted in the email below was an additional > mechanism to set -fmacro-prefix-map and -fdebug-prefix-map via an > environment variable. This was not accepted into GCC because they are > (in summary)

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Kristina Brooks via Phabricator via cfe-commits
kristina added a comment. I should add that this is not just about reproducible builds but about code size as mentioned by @NSProgrammer. There are ways to cheat with builtins but the problem is, entire __FILE__ string is still emitted into read-only data, despite the constexpressiveness of

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Ximin Luo via cfe-commits
Hi all, more strict interpretations of reproducible builds want build paths to not appear in the final output *regardless of the build location* and so /tmp/build would not be appropriate. Rough justification is that we want different people building under different starting conditions to be

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Nolan O'Brien via cfe-commits
I believe reproducible build projects simply move their source to `/tmp/build` or something else that’s consistent to deal with `__FILE__` currently. They’d probably appreciate this to avoid file copying during `make` builds Nolan O'Brien Sent from my iPhone > On Jan 3, 2019, at 7:47 AM,

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Kristina Brooks via Phabricator via cfe-commits
kristina added a comment. In 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

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Roman Lebedev via cfe-commits
No, that is the opposite of the solution, actually, i think. https://tests.reproducible-builds.org/debian/issues/unstable/gcc_captures_build_path_issue.html And: https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00513.html ^ i suspect clang should be compatible with whatever approach is suggested

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Roman Lebedev via cfe-commits
Just a thought: reproducible builds will surely be interested in this. Did gcc already solve this problem? And if yes, it would be best to be compatible. On Thu, Jan 3, 2019 at 6:41 PM Nolan O'Brien via Phabricator via cfe-commits wrote: > > NSProgrammer added a comment. > > To throw in my 2

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Nolan O'Brien via Phabricator via cfe-commits
NSProgrammer added a comment. 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

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Kristina Brooks via Phabricator via cfe-commits
kristina added a comment. I like the idea of just getting the filename reliably, but I think an extension to strip path prefixes is a bit of an overkill especially as yet another compiler flag. I implemented a similar thing in my fork in form of a directive to `__generate(...)` which is my own

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2019-01-03 Thread Karl-Johan Karlsson via Phabricator via cfe-commits
Ka-Ka added a comment. Ping? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D17741/new/ https://reviews.llvm.org/D17741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2018-12-18 Thread Karl-Johan Karlsson via Phabricator via cfe-commits
Ka-Ka added a comment. Ping? Do you think this small lit testcase below work as a testcase for the -ffile-macro-prefix-to-remove option? // RUN: %clang_cc1 -emit-llvm %s -o - -ffile-macro-prefix-to-remove=%s | FileCheck %s char this_file[] = __FILE__; // CHECK: @this_file = global [1 x i8]

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2018-05-15 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a reviewer: vsapsai. dexonsmith added a comment. In https://reviews.llvm.org/D17741#1067816, @weimingz wrote: > split the original into two parts. This one supports > -ffile-macro-prefix-to-remove function. > > I locally verified it. To add a test case, do we need to use VFS?

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2018-04-13 Thread Weiming Zhao via Phabricator via cfe-commits
weimingz updated this revision to Diff 142499. weimingz edited the summary of this revision. weimingz added a comment. split the original into two parts. This one supports -ffile-macro-prefix-to-remove function. I locally verified it. To add a test case, do we need to use VFS?

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2018-04-13 Thread Rick Mann via Phabricator via cfe-commits
JetForMe added a comment. Just want to comment that this functionality is also good for security, as it enables hiding of path information in final builds (while still allowing logging to show file and line number). https://reviews.llvm.org/D17741

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2018-04-13 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith requested changes to this revision. dexonsmith added a comment. This revision now requires changes to proceed. Hal requested splitting the patch in two, since the two features are separable, but they both still seem to be here. Perhaps start with the prefix patch?

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-09-06 Thread Weiming Zhao via cfe-commits
weimingz added a comment. ping? https://reviews.llvm.org/D17741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-04-22 Thread Weiming Zhao via cfe-commits
weimingz added a comment. Ping ? http://reviews.llvm.org/D17741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-04-08 Thread Weiming Zhao via cfe-commits
weimingz updated this revision to Diff 53105. weimingz added a comment. per Alex's suggestion, split into 2 flags: -ffile-macro-prefix-to-remove=xxx : remove matched prefix -ffile-macro-basename-only : remove the whole dir part http://reviews.llvm.org/D17741 Files:

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-04-08 Thread Weiming Zhao via cfe-commits
weimingz added a subscriber: weimingz. weimingz added a comment. Sounds good. Will do. Thanks for reviewing http://reviews.llvm.org/D17741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-04-08 Thread Zhao, Weiming via cfe-commits
Sounds good. Will do. Thanks for reviewing On 4/8/2016 11:46 AM, Alex Rosenberg wrote: alexr added a subscriber: alexr. alexr added a comment. There are multiple features in this patch that should be considered separately. Please split the patch. That said, I don't think we want to add a

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-04-08 Thread Alex Rosenberg via cfe-commits
alexr added a subscriber: alexr. alexr added a comment. There are multiple features in this patch that should be considered separately. Please split the patch. That said, I don't think we want to add a fundamental new preprocessor feature like __FILE_BASENAME__ without at least getting some

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-21 Thread Weiming Zhao via cfe-commits
weimingz added a comment. In http://reviews.llvm.org/D17741#374725, @weimingz wrote: > In http://reviews.llvm.org/D17741#372098, @weimingz wrote: > > > rebased > > > ping~ HI, Any comments/suggestions? http://reviews.llvm.org/D17741 ___

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-14 Thread Weiming Zhao via cfe-commits
weimingz added a comment. In http://reviews.llvm.org/D17741#372098, @weimingz wrote: > rebased ping~ http://reviews.llvm.org/D17741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-10 Thread Weiming Zhao via cfe-commits
weimingz updated this revision to Diff 50300. weimingz added a comment. rebased http://reviews.llvm.org/D17741 Files: include/clang/Driver/Options.td include/clang/Lex/Preprocessor.h include/clang/Lex/PreprocessorOptions.h lib/Driver/Tools.cpp lib/Frontend/CompilerInvocation.cpp

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-04 Thread Craig, Ben via cfe-commits
On 3/4/2016 6:23 AM, Joerg Sonnenberger via cfe-commits wrote: On Thu, Mar 03, 2016 at 04:50:11PM -0800, Nico Weber via cfe-commits wrote: On Thu, Mar 3, 2016 at 4:28 PM, Joerg Sonnenberger via cfe-commits < cfe-commits@lists.llvm.org> wrote: On Thu, Mar 03, 2016 at 02:09:17PM -0800, Nico

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-04 Thread Joerg Sonnenberger via cfe-commits
On Thu, Mar 03, 2016 at 04:50:11PM -0800, Nico Weber via cfe-commits wrote: > On Thu, Mar 3, 2016 at 4:28 PM, Joerg Sonnenberger via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > > > On Thu, Mar 03, 2016 at 02:09:17PM -0800, Nico Weber via cfe-commits wrote: > > > On Thu, Mar 3, 2016 at

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Nico Weber via cfe-commits
On Thu, Mar 3, 2016 at 4:28 PM, Joerg Sonnenberger via cfe-commits < cfe-commits@lists.llvm.org> wrote: > On Thu, Mar 03, 2016 at 02:09:17PM -0800, Nico Weber via cfe-commits wrote: > > On Thu, Mar 3, 2016 at 1:50 PM, Joerg Sonnenberger via cfe-commits < > > cfe-commits@lists.llvm.org> wrote: > >

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Mar 03, 2016 at 02:09:17PM -0800, Nico Weber via cfe-commits wrote: > On Thu, Mar 3, 2016 at 1:50 PM, Joerg Sonnenberger via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > > > On Thu, Mar 03, 2016 at 07:39:04PM +, Weiming Zhao via cfe-commits > > wrote: > > > Change the option

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Nico Weber via cfe-commits
On Thu, Mar 3, 2016 at 1:50 PM, Joerg Sonnenberger via cfe-commits < cfe-commits@lists.llvm.org> wrote: > On Thu, Mar 03, 2016 at 07:39:04PM +, Weiming Zhao via cfe-commits > wrote: > > Change the option name to -ffile-macro-prefix-to-remove > > This still sounds to me like a solution for a

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Joerg Sonnenberger via cfe-commits
On Thu, Mar 03, 2016 at 07:39:04PM +, Weiming Zhao via cfe-commits wrote: > Change the option name to -ffile-macro-prefix-to-remove This still sounds to me like a solution for a very restricted part of a much more generic problem... Joerg ___

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Weiming Zhao via cfe-commits
weimingz updated the summary for this revision. weimingz updated this revision to Diff 49762. weimingz added a comment. Change the option name to -ffile-macro-prefix-to-remove http://reviews.llvm.org/D17741 Files: include/clang/Driver/Options.td include/clang/Lex/Preprocessor.h

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Hal Finkel via cfe-commits
hfinkel added a subscriber: hfinkel. hfinkel added a comment. In http://reviews.llvm.org/D17741#367113, @weimingz wrote: > Add "-f__FILE__-prefix-to-remove" flag to support the trim of the prefix. > Passing special value __ALL_DIR__ to remove all dir parts. > > For example FILE is /a/b/c >

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-03 Thread Weiming Zhao via cfe-commits
weimingz updated this revision to Diff 49713. weimingz added a comment. Add "-f__FILE__-prefix-to-remove" flag to support the trim of the prefix. Passing special value __ALL_DIR__ to remove all dir parts. For example FILE is /a/b/c -f__FILE__-prefix-to-remove=/a/ will cause FILE be expanded to

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-01 Thread Ben Craig via cfe-commits
bcraig added a comment. In http://reviews.llvm.org/D17741#365457, @thakis wrote: > > I think we can do this separately. A "basename" macro is easier for > > programmers to use and no build system change needed. > > > Hm, I would think that adding a flag to your CFLAGS is easier than getting >

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-01 Thread Sean Silva via cfe-commits
On Tue, Mar 1, 2016 at 10:54 AM, Nico Weber via cfe-commits < cfe-commits@lists.llvm.org> wrote: > thakis added a comment. > > > I think we can do this separately. A "basename" macro is easier for > programmers to use and no build system change needed. > > > Hm, I would think that adding a flag

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-01 Thread Nico Weber via cfe-commits
thakis added a comment. > I think we can do this separately. A "basename" macro is easier for > programmers to use and no build system change needed. Hm, I would think that adding a flag to your CFLAGS is easier than getting all your dependencies to use a clang-only new macro…

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-01 Thread Ben Craig via cfe-commits
bcraig added a comment. LGTM. You should probably wait for someone else to approve it though. http://reviews.llvm.org/D17741 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-03-01 Thread Weiming Zhao via cfe-commits
weimingz added a comment. In http://reviews.llvm.org/D17741#364954, @thakis wrote: > In http://reviews.llvm.org/D17741#364931, @weimingz wrote: > > > In http://reviews.llvm.org/D17741#364756, @thakis wrote: > > > > > Instead of doing this, would it make sense to have a flag like > > >

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Nico Weber via cfe-commits
thakis added a comment. In http://reviews.llvm.org/D17741#364931, @weimingz wrote: > In http://reviews.llvm.org/D17741#364756, @thakis wrote: > > > Instead of doing this, would it make sense to have a flag like > > -ffile-basename that changes what __FILE__ expands to? > > > > I had wished I'd

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Weiming Zhao via cfe-commits
weimingz updated this revision to Diff 49445. weimingz added a comment. rename the macro to CLANG_FILE_BASENAME per Ben's comments. http://reviews.llvm.org/D17741 Files: include/clang/Lex/Preprocessor.h lib/Lex/PPMacroExpansion.cpp test/Lexer/file_basename.c Index:

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Weiming Zhao via cfe-commits
weimingz added a comment. In http://reviews.llvm.org/D17741#364756, @thakis wrote: > Instead of doing this, would it make sense to have a flag like > -ffile-basename that changes what __FILE__ expands to? > > I had wished I'd be able to have some control over __FILE__ (I'd like to say > "make

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Joerg Sonnenberger via cfe-commits
joerg added a subscriber: joerg. joerg added a comment. I've added functionality like that to NetBSD's GCC a long time ago. That functionality is useful for a variety of situations, cutting down file space or canonicalization are two uses.

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Nico Weber via cfe-commits
thakis added a subscriber: thakis. thakis added a comment. Instead of doing this, would it make sense to have a flag like -ffile-basename that changes what __FILE__ expands to? I had wished I'd be able to have some control over __FILE__ (I'd like to say "make all __FILE__s relative to this

Re: [PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Ben Craig via cfe-commits
bcraig added a subscriber: bcraig. bcraig added a comment. Note: this doesn't count as an official "LGTM". The code change seems fine to me. I think this has been implemented in gcc as well, but I don't recall for certain. If this has been implemented in gcc, then I would expect the

[PATCH] D17741: adds __FILE_BASENAME__ builtin macro

2016-02-29 Thread Weiming Zhao via cfe-commits
weimingz created this revision. weimingz added a subscriber: cfe-commits. __FILE__ will be expanded to the full path. In some embedded system scenarios, the final images is linked from many objs and the image size is a very important factor. The full filenames can occupy a lot space in the