[PATCH] D40925: Add option -fkeep-static-consts

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 25 11:17:54 PDT 2018


erichkeane added a comment.

In https://reviews.llvm.org/D40925#1276114, @rnk wrote:

> My coworker, @zturner, asked if I knew a way to force emit all constants, and I mentioned this flag, but we noticed it doesn't work on cases when the constant is implicitly static, like this:
>
>   const int foo = 42;
>
>
> If I add `static` to it, it gets emitted with -fkeep-static-consts, but as is, it doesn't get emitted.
>
> Do you think it's worth extending the logic to handle this case? GCC seems to that global `foo` regardless of the flag setting.


I looked into it real quick, and think that checking storage class instead of duration is incorrect here.  See https://reviews.llvm.org/D53718 for the fix @zturner is asking for (I think!).


Repository:
  rC Clang

https://reviews.llvm.org/D40925





More information about the cfe-commits mailing list